Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11562 (new defect)

Opened 1 month ago

[PATCH] Associations' dynamic finders fail with :order depends on :include

Reported by: jes5199 Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: normal Keywords:
Cc:

Description

Dynamic finders generate invalid queries when they are called on an association like: has_many :posts, :include => :comments, :order_by => 'comments.position' because :include is getting ignored. (using non-dynamic #find() works correctly)

I've attached test cases that cause this error and a patch to fix it. Tested against Trunk.

Attachments

tests_dynamic_finders_on_associations_with_include_and_order.diff (4.2 kB) - added by jes5199 on 04/10/08 07:55:40.
patch_fix_dynamic_finders_on_associations_with_include_and_order.diff (2.0 kB) - added by jes5199 on 04/10/08 07:58:25.

Change History

04/10/08 07:55:40 changed by jes5199

  • attachment tests_dynamic_finders_on_associations_with_include_and_order.diff added.

04/10/08 07:58:25 changed by jes5199

  • attachment patch_fix_dynamic_finders_on_associations_with_include_and_order.diff added.