membership = Membership.where(user_id: 1, group_id: 1).first
# some other code
membership.update_attributes(admin: true)
generates a query
UPDATE 'memberships' SET 'admin' = 1 WHERE 'memberships'.'' IS NULL
which results in an error.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
'memberships'.'' IS NULLhave to be'memberships'.'id'=And there is no id in model I suppose.
Then the right way to update attribute will be something like that
UPDATE
Seems adding the id to this model will be the best choice.