Displaying 1 result from an estimated 1 matches for "conversationscontroller".
2010 Aug 29
4
Wrong class being returned in association
...c and have the following models:
class User
has_many :readings
has_many :conversations, :through=>:readings
end
class Reading
belongs_to :user
belongs_to :conversation
end
class Conversation
has_many :readings
has_many :users, :through=>:readings
end
and this controller code:
class ConversationsController
def show
@user = User.find(params[:user_id])
@conversation = @user.conversations.find(params[:id])
debugger
end
end
After requesting conversations#show, go to debug console and:
User.class.object_id
=> 116350
@conversation.users.first.class.object_id
=> 33660870
@conversation.use...