A blank rails project to help debug a possible bug with ActiveRecord Association extensions when used together with named_scopes
bowsersenior/test_association_extensions
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
== Bug with Association Extensions when used together with named_scope https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1221-association-extensions-and-scopes-on-the-associated-model-behave-inconsistantly#ticket-1221-4 An example: >> Rails.version "2.3.8" >> b = Blog.first #<Blog:0x2397edc> { :id => 1, :created_at => Thu, 19 Aug 2010 19:36:44 UTC +00:00, :updated_at => Thu, 19 Aug 2010 19:36:44 UTC +00:00 } >> b.entries [ [0] #<Entry:0x23767b4> { :id => 1, :status => "active", :blog_id => 1, :created_at => Thu, 19 Aug 2010 19:37:02 UTC +00:00, :updated_at => Thu, 19 Aug 2010 19:37:02 UTC +00:00 }, [1] #<Entry:0x2376750> { :id => 2, :status => "active", :blog_id => 1, :created_at => Thu, 19 Aug 2010 19:37:04 UTC +00:00, :updated_at => Thu, 19 Aug 2010 19:37:04 UTC +00:00 }, [2] #<Entry:0x2376700> { :id => 3, :status => "inactive", :blog_id => 1, :created_at => Thu, 19 Aug 2010 19:37:06 UTC +00:00, :updated_at => Thu, 19 Aug 2010 19:37:06 UTC +00:00 } ] >> b.entries.active.print active active inactive # this shouldn't be here! nil >> Blog.first.entries.active.print active active nil >> Blog.first.entries.inactive.print inactive nil Another example: >> c = Blog.first #<Blog:0x237af58> { :id => 1, :created_at => Thu, 19 Aug 2010 19:36:44 UTC +00:00, :updated_at => Thu, 19 Aug 2010 19:36:44 UTC +00:00 } >> c.entries.inactive [ [0] #<Entry:0x2374a54> { :id => 3, :status => "inactive", :blog_id => 1, :created_at => Thu, 19 Aug 2010 19:37:06 UTC +00:00, :updated_at => Thu, 19 Aug 2010 19:37:06 UTC +00:00 } ] >> c.entries.inactive.print inactive nil >> c.entries.print inactive nil >> c.entries [ [0] #<Entry:0x236ccdc> { :id => 3, :status => "inactive", :blog_id => 1, :created_at => Thu, 19 Aug 2010 19:37:06 UTC +00:00, :updated_at => Thu, 19 Aug 2010 19:37:06 UTC +00:00 } ] >> Blog.first.entries [ [0] #<Entry:0x2363f10> { :id => 1, :status => "active", :blog_id => 1, :created_at => Thu, 19 Aug 2010 19:37:02 UTC +00:00, :updated_at => Thu, 19 Aug 2010 19:37:02 UTC +00:00 }, [1] #<Entry:0x2363ec0> { :id => 2, :status => "active", :blog_id => 1, :created_at => Thu, 19 Aug 2010 19:37:04 UTC +00:00, :updated_at => Thu, 19 Aug 2010 19:37:04 UTC +00:00 }, [2] #<Entry:0x2363e70> { :id => 3, :status => "inactive", :blog_id => 1, :created_at => Thu, 19 Aug 2010 19:37:06 UTC +00:00, :updated_at => Thu, 19 Aug 2010 19:37:06 UTC +00:00 } ]
About
A blank rails project to help debug a possible bug with ActiveRecord Association extensions when used together with named_scopes
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published