Re: [Rails-core] Eager loading for both find_by_sql and associations using custom finder_sql
Tom Ward wrote: Is there any way you can implement your changes as a plugin, or are they too deeply imbedded into ActiveRecord? In either case, it's worth releasing your code one way or another, as someone will surely find it useful, even if it never makes into the main core. Tom, a plugin's a good idea because the changes to AR are pretty small. Here's the code in a file that can be put in an app's lib directory and require-ed in environment.rb: http://mrj.bpa.nu/eager_custom_sql.rb I haven't yet worked out how to turn this into a working plugin. Mark ___ Rails-core mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-core
[Rails-core] Two issues with through associations
Extending DHH's example of a through association somewhat: class Author has_many :authorships has_many :books, :class_name => 'Textbook', # <-- do not include :through => :authorships, :include => :chapters # <-- inoperative end class Textbook has_many :authorships has_many :authors, :through => :authorships has_many :chapters end class Authorship belongs_to :author belongs_to :book, :class_name => 'Textbook' end class Chapter < ActiveRecord::Base belongs_to :textbook end 1. In the through association documentation it should be noted that the :class_name => 'Textbook' option should not be included in the through association declaration itself, otherwise Rails looks for a :textbook association in Authorship. 2. Through associations do not currently support the :include option, either in their declarations or through an :include on the source belongs_to declaration. author.books.find(:all, :include => :chapters) does however work, so it should be easy to get a default include working. Mark ___ Rails-core mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-core
Re: [Rails-core] Two issues with through associations
> 2. Through associations do not currently support the :include > option, either in their declarations or through an :include > on the source belongs_to declaration. > author.books.find(:all, :include => :chapters) does however work, > so it should be easy to get a default include working. As of [3974] they do. -- Rick Olson http://techno-weenie.net ___ Rails-core mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-core
[Rails-core] RJS Collection Proxies
RJS collection proxies are currently broken for mixed case methods like findAll or sortBy. I've added a patch in http://dev.rubyonrails.org/ticket/4314. In looking into the patch I was led to wonder if it might be useful to add an option :lower to camelize to generate lower camel case names? "my_name".camelize(:lower) #=> myName -- Cody Fauser http://www.codyfauser.com ___ Rails-core mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-core
Re: [Rails-core] RJS Collection Proxies
On 3/19/06, Cody Fauser <[EMAIL PROTECTED]> wrote: > RJS collection proxies are currently broken for mixed case methods > like findAll or sortBy. I've added a patch in > http://dev.rubyonrails.org/ticket/4314. > > In looking into the patch I was led to wonder if it might be useful to > add an option :lower to camelize to generate lower camel case names? > > "my_name".camelize(:lower) #=> myName > > -- > Cody Fauser > http://www.codyfauser.com > ___ > Rails-core mailing list > [email protected] > http://lists.rubyonrails.org/mailman/listinfo/rails-core > #4314 is in. And because you've been such a great sport, #4194 is in too. Thanks for the patches. Some kind of option for camelizing javascript names is definitely needed as we get into more javascript generation. -- Rick Olson http://techno-weenie.net ___ Rails-core mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-core
Re: [Rails-core] RJS Collection Proxies
Thanks Rick! On 3/19/06, Rick Olson <[EMAIL PROTECTED]> wrote: > On 3/19/06, Cody Fauser <[EMAIL PROTECTED]> wrote: > > RJS collection proxies are currently broken for mixed case methods > > like findAll or sortBy. I've added a patch in > > http://dev.rubyonrails.org/ticket/4314. > > > > In looking into the patch I was led to wonder if it might be useful to > > add an option :lower to camelize to generate lower camel case names? > > > > "my_name".camelize(:lower) #=> myName > > > > -- > > Cody Fauser > > http://www.codyfauser.com > > ___ > > Rails-core mailing list > > [email protected] > > http://lists.rubyonrails.org/mailman/listinfo/rails-core > > > > #4314 is in. And because you've been such a great sport, #4194 is in too. > > Thanks for the patches. Some kind of option for camelizing javascript > names is definitely needed as we get into more javascript generation. > > -- > Rick Olson > http://techno-weenie.net > ___ > Rails-core mailing list > [email protected] > http://lists.rubyonrails.org/mailman/listinfo/rails-core > -- Cody Fauser http://www.codyfauser.com ___ Rails-core mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-core
Re: [Rails-core] Two issues with through associations
Rick Olson wrote: 2. Through associations do not currently support the :include option, either in their declarations or through an :include on the source belongs_to declaration. As of [3974] they do. That's service! It works fine in 3974, though I get a load stack overflow error in 3985 due to some other issue. Mark ___ Rails-core mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-core
Re: [Rails-core] RJS Collection Proxies
> > "my_name".camelize(:lower) #=> myName This now works. -- David Heinemeier Hansson http://www.loudthinking.com -- Broadcasting Brain http://www.basecamphq.com -- Online project management http://www.backpackit.com -- Personal information manager http://www.rubyonrails.com -- Web-application framework ___ Rails-core mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-core
[Rails-core] Strip Owner Name From Table Aliases On Eager Loading
Can someone tell me why this patch is important? http://dev.rubyonrails.org/ticket/4251 """ I think the name says it all. Basically we are taking LEFT OUTER JOIN dbo.Users AS dbo.Users and making it LEFT OUTER JOIN dbo.Users AS Users. """ Do the aliases cause issues if they have periods in them? Would I be potentially hurting folks using tables owned by different users? FWIW it would probably be a simple change with the new #table_alias_for method: http://dev.rubyonrails.org/browser/trunk/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb#L16 -- Rick Olson http://techno-weenie.net ___ Rails-core mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-core
