Cannot understand why does find_or_create method cannot accept model
instances instead of their ids:
Friendship.find_or_create_by_user_id_and_friend_id(User.first.id,
User.last.id) # works just fine
Friendship.find_or_create_by_user_id_and_friend_id(User.first,
User.last) # and even
Friendship.find_or_create_by_user_id_and_friend_id(User.first, Message.last)
rollbacks because of validation (user and friend cannot be the same person):
#<Friendship id: nil, user_id: 1, friend_id: 1, state: "pending",
created_at: nil, updated_at: nil>
So it interprets model instances as true or something like that. I've
stopped my search at assign_attributes method of ActiveRecord::Base
string send("#{k}=", v)
Is this correct behaviour?-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
