collection_singular_ids inconsistent with collections when source and conditions present #822

lighthouse-import opened this Issue May 16, 2011 · 2 comments

1 participant


Imported from Lighthouse. Original ticket at:
Created by yinhm - 2011-02-01 08:32:50 UTC

Imaging your have a User model, which define a has_many association like:

           :through => :subscriptions,
           :conditions => "streams.category ='group'",
           :source => :stream)

user.subscribed_groups and user.subscribed_group_ids will generating different SQL and returns different records.

Adding a extra criterion fixed this:

activerecord-3.0.3/lib/active_record/associations.rb diffs:

<               if reflection.through_reflection && reflection.source_reflection.belongs_to? 
>               if reflection.through_reflection && reflection.source_reflection.belongs_to? && 
>                   reflection.options[:conditions]

Imported from Lighthouse.
Comment by rails - 2011-05-02 00:00:10 UTC

This issue has been automatically marked as stale because it has not been commented on for at least three months.

The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.


Imported from Lighthouse.
Comment by Anatoliy Lysenko - 2011-05-07 13:29:20 UTC

[state:open] Is not fixed on master c444b0f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment