Hi all,
I found a strange behaviour in eager loading:

class Category < ActiveRecord::Base
   has_and_belongs_to_many :movies
   has_and_belongs_to_many :most_recent_movies, :class_name => 'Movie', 
:order => 'created_at DESC', :limit => 10
end

class Movie < ActiveRecord::Base
   has_and_belongs_to_many :categories
end

Category.find(1).most_recent_movies # => returns 10 movies

Category.find(1, :include => :most_recent_movies).most_recent_movies # 
=> returns all the associated movies

I fixed it, you can find the patch at:
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/505-eager-loading-doesn-t-respect-limit-option-of-the-loaded-association


Best,
Luca
-- 
blog: www.lucaguidi.com
Pro-Netics: www.pro-netics.com
Sourcesense - making sense of Open Source: www.sourcesense.com

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to