Created
January 6, 2011 13:55
-
-
Save soulnafein/767908 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Just a note, Event has 2 associations | |
has_many :attendances | |
has_many :attendees, :through => :attendances, :source => :user | |
#Irb session that shows the problem | |
Loading development environment (Rails 3.0.3) | |
ruby-1.8.7-p302 > u = User.new | |
=> #<User id: nil, full_name: nil, tagline: nil, bio: nil, location: nil, company: nil, job_title: nil, website: nil, twitter_username: nil, linkedin_profile: nil, github_account: nil, created_at: nil, updated_at: nil, interests: nil, email: nil, phone_number: nil, blog_feed: nil, username: nil, crypted_password: nil, password_salt: nil, persistence_token: nil, active: nil, perishable_token: nil, agreed_tc_and_pp: false, bitbucket_account: nil, delicious_username: nil, country: nil, city: nil> | |
ruby-1.8.7-p302 > u.id = 42 | |
=> 42 | |
ruby-1.8.7-p302 > e = Event.new | |
=> #<Event id: nil, title: nil, city: nil, country: nil, description: nil, link: nil, created_at: nil, updated_at: nil, date: nil, group_id: nil, disabled: false> | |
ruby-1.8.7-p302 > an_array = [] | |
=> [] | |
ruby-1.8.7-p302 > an_array.push(u); e.attendees.push(u) | |
=> [#<User id: 42, full_name: nil, tagline: nil, bio: nil, location: nil, company: nil, job_title: nil, website: nil, twitter_username: nil, linkedin_profile: nil, github_account: nil, created_at: nil, updated_at: nil, interests: nil, email: nil, phone_number: nil, blog_feed: nil, username: nil, crypted_password: nil, password_salt: nil, persistence_token: nil, active: nil, perishable_token: nil, agreed_tc_and_pp: false, bitbucket_account: nil, delicious_username: nil, country: nil, city: nil>] | |
ruby-1.8.7-p302 > an_array.include?(u) | |
=> true | |
ruby-1.8.7-p302 > e.attendees.include?(u) | |
=> false <------ WHAT THE FUCK? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment