Displaying 20 results from an estimated 21 matches for "garysweav".
Did you mean:
garysweaver
2012 Sep 19
7
Renaming Journey and avoiding libraries with common noun names
Hi all,
I know this is a long shot, but could renaming the "Journey" module please
be considered by those in a position to support it?
I''ve written an issue on this in the journey repo also:
https://github.com/rails/journey/issues/49
Essentially our project has a model named Journey, the same as Rails 3.2''s
new routing driver. As a consequence we can no longer
2012 Oct 17
2
autolog: easily debug-like logging on the fly in your Rails app
If it helps anyone developing Rails apps or gems, I wrote a shortcut for
set_trace_func, so next time you want to just add a line before and after
some function you are trying to debug you can have Ruby temporarily output
every line, method, etc. executed. Also, it lets you define the format, use
other loggers, etc. via a proc/lambda define, since you might not like the
default format.
2012 Dec 21
5
Security Expose: Assume folks have seen this -
http://www.reddit.com/r/netsec/comments/158g8s/hijacking_ruby_on_rails_apps_through_exposed/
FYI
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com.
For more options,
2012 Oct 01
1
active_model_serializers, more than one level deep of associations, specifying serializers per association
...e_model_serializers), strong_parameters,
and the "permitter" strategy that Adam Hawkins is using:
http://broadcastingadam.com/2012/07/parameter_authorization_in_rails_apis/
Code so far is here (in the integrate-twinturbo_strategy_for_param_authr
branch if you clone):
https://github.com/garysweaver/restful_json/tree/integrate-twinturbo_strategy_for_param_authr
Autogenerated serializer and permitter classes for each model that has a
table (~270 permitters, ~270 serializers), which means a lot of attribute
and association name duplication, but it''s what I''ve got for now....
2013 Apr 02
10
Suggested strategies for testing a gem against Rails 3.x and Rails 4?
I''ve seen a few examples of dummy Rails apps (for testing, so they live
under test or spec dirs, typically) for use with the Appraisals gem that
supposedly work with both Rails 3.x and Rails 4, but they seem hackish and
not fully functional. It is somewhat expected, as it is a stripped down
Frankenstein monster that is trying to be compatible with various versions
of Rails 3 as well
2012 Sep 18
4
"best practices" for Rails serving RESTful JSON services for use by AngularJS, Ember.js, etc.
...mber.js, etc. in such a way that the user
doesn''t have to tweak a a bunch of rails g controller boilerplate code to
provide services for use in these frameworks that in turn would require
various changes to fit the normal Rails way to specify things.
The gem is here:
https://github.com/garysweaver/restful_json
It needs a heck of a lot of work still, no working tests at the moment, and
integrating roar-rails in its 3.0.0 branch.
Our aim/current strategy for web development is to:
1. Keep # of controllers (and amount of code required for each) to a
minimum, but they shouldn''t b...
2012 Sep 28
1
How to Include Associations in #as_json
Hi,
Does anyone know how to include nested associations when overriding a
model''s #as_json method?
Below is my attempt to include direct and nested associations.
NOTE: "office" is a direct association, "company" is nested association
via "office". I''d like both included in the generated json output.
def as_json(options={})
super(:include
2013 May 22
2
Creating nested hash from nested active record results
Hello,
I''m trying to find a very abstract and "one size fits all" for
converting nested active record results to nested hashes. It''s easy,
to do one level deep as such:
[code]
results_to_hash = Hash[ found_categories.map{ |c| [c.id, c.title]}]
[/code]
But, when I try to add another collection to the mix, it completely
borks and the results_to_hash only returns an
2010 Mar 23
1
:has_many and :controller specified in routes.rb
Have an app using older version of Rails (2.3.2) that I need some
routing assistance with if anyone has a minute.
The app was originally designed to be purely html view, and an xml and
json api was hacked on. To keep it clean, we are now moving the first
version of the api (v1) under its own directory (v1) under app/
controllers but still responding to the old paths.
One of the parts of the new
2012 Oct 17
2
autolog: set_trace_func without all the typing
If it helps anyone developing Rails, apps, or gems, I wrote a shortcut for
set_trace_func, so next time you want to just add a line before and after
some function you are trying to debug you can have Ruby temporarily output
every line, method, etc. executed. Also, it lets you define the format, use
other loggers, etc. via a proc/lambda define, since you might not like the
default format.
2012 Sep 28
0
Overriding class_attribute writers and order of super/extend C.M./included block eval in ActiveSupport::Concern
I have:
module MySpike
extend ActiveSupport::Concern
included do
class_attribute :foobar, instance_writer: true
end
end
But, I want to be able to override the class attribute writer and/or
instance writer method to do something when the attribute is set via
self.foobar = true before or after calling super to set the attribute.
Unfortunately, I can''t find a clean way
2013 Jun 25
1
Casting gem usage in Rails 4/Ruby 2 vs. Rails 4 push for concern usage/Rails delegation
Just read about the Casting gem:
https://discuss.gemnasium.com/t/casting-adding-behavior-to-objects-without-using-extend/34
https://github.com/saturnflyer/casting
What are the Rails core team''s opinions about using Casting vs.
ActiveSupport::Concern usage, Rails delegation, etc.?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2012 Nov 19
0
has_one :through NoMethodError: undefined method `klass' for nil:NilClass when doing class_name on reflection
Not sure if this is expected or not. Only happened with a has_one :through
I had setup. (Workaround is just to remove it and go through the
association manually vs has_one ..., through: .)
Not a big deal if no one has time to look at it, as it''s not a big enough
deal to look into a fix on our side.
In Rails (3.2.9) console if I do:
MyModel.reflections.each {|name,reflection|
2012 Oct 03
1
Is there planned support for permitting params one at a time vs. all at once in strong_parameters/Rails 4?
Was going to have a variety of request params sent in and use a
class_attribute that would define types of request parameters that are
allowed. strong_parameters wouldn''t be too much trouble in such a case if
it would allow me to manually permit some attributes (dynamically
determined) in the controller but allow strong_parameters to enforce
security of others.
Is this something
2012 Dec 12
1
#8498 postgres_adapter fix for disable_referential_integrity
Please review this patch for postgres adapter''s referential_integrity.rb in
Rails master and 3.2.9 and let me know what you think. We are using it via
an initializer (monkey patching the adapter directly vs. in module):
https://github.com/rails/rails/pull/8498
Fixes this issue also seen by others in Foreigner:
https://github.com/matthuhiggins/foreigner/issues/61
Problem that it
2012 Dec 18
2
cache-busting non-digest assets in sprockets in development a good idea? should headers in sprockets be configurable?
Just monkey patched Sprockets in our Rails 3.2.9 app to override the
Cache-Control header for html assets that we need to tweak more often in
development, but that we don''t want to use digests/fingerprinting with:
# Sprockets 2.x patch
if Rails.env.development?
module Sprockets
module Server
private
alias_method :sprockets_headers, :headers
def headers(env,
2012 Sep 21
4
Good resource for the history of activerecord association method naming?
Someone asked me about the history of the method naming in activerecord and
I wasn''t sure where to point them. For example, there was early criticism
noted of has_and_belongs_to_many in this old post from 2005:
http://hans.fugal.net/blog/2005/10/03/habtm/
I was mentioning that many_to_many is not used because there are a few
different ways of doing that via has_many :through and
2013 Apr 15
4
Rails' scaffold controller generator - should it test json format also?
(Forgive me if this is incorrect, because I recognized this initially as
something in Rails 4.0.0.beta1 and have just done a cursory look over the
latest generator code.)
Noticed in Rails 4 that the test generated for a scaffold controller only
tests the html format instead of both html and json:
2012 Oct 18
0
unexpected return (LocalJumpError) only when executing this code within autoloaded classes?
Posted on stackoverflow but no traction yet:
http://stackoverflow.com/questions/12942505/why-does-using-set-trace-func-work-in-some-places-but-cause-unexpected-return-l
The following is a generified part of the code in a gem I''m working on:
module SomeModule
class << self
attr_accessor :procedure
def log_events(*args)
args.flatten!
2012 Aug 13
10
Question about PATCH method, accepts_nested_attributes_for, and updates to association lists (has_many, HABTM)
Am interested in the new PATCH method that will be included in Rails 4, but
have a question/concern, and forgive me if I''m misunderstanding it.
So, if the request parameter _method is set to "patch", the update is
processed as a patch.
But, let''s say you have a model called Airplane and Airplane has a
collection of FlightCrewMembers which it