I have this error, and I'm not doing anything special:
NameError ( Undefined method for 'message_id_equals' class 'ActiveRecord :: Relationship') Why? Here is the reference:
@user_has_message = UserHasMessages.user_id_is (current_user.id) .message_id_is (@ message.id) irb (main): 012: 0> UserHasMessages = & gt; UserHasMessages (id: integer, user_id: integer, message_id: integer, is_seender: boolean, created_at: datetime, updated_at: datetime)
You can not add those things together in that way. You are called User_id_is on UserHasMessages, which gives an ActiveRecord response that does not have any method for message_id_is. I do not really know what these methods are, but my guess is that they are not scopes or you Can allow series.
You can not do this:
@user_has_message = UserHasMessages.where (: user_id = & gt; current_user.id ,: message_id = & gt; @ message Id) to get the same effect?
Comments
Post a Comment