Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

association.include?(associated) fails oddly #5

Open
jamesarosen opened this issue Jul 2, 2009 · 1 comment
Open

association.include?(associated) fails oddly #5

jamesarosen opened this issue Jul 2, 2009 · 1 comment

Comments

@jamesarosen
Copy link

I have a owner model:

class Person < ActiveRecord::Base
  has_many_polymorphs :things, :from => [ :books, :cds, :dvds ], :through => :person_things
end

a relationship model:

class PersonThing < ActiveRecord::Base
  belongs_to :person
  belongs_to :thing, :polymorphic => true
end 

and several owned models:

class Book < ActiveRecord::Base
end
...

If I create a relationship:

person = Person.create!(:name => 'Barney')
book = Book.create!('Dinosaurs for Dummies')
person.things << book

then include? fails even when select doesn't:

person.things.include? book
# => false
person.things.select { |t| t == book }.any?
# => true

I'm guessing include? is redefined on this enumeration, but it's not redefined correctly.

@ghost
Copy link

ghost commented Aug 5, 2009

best bet is to make a failing test and fix it yourself; this project is in patch-accepting-mode only :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant