I have a join table, which have 3 parameters. I want to update it, using a where-clause, something like this: (which obviously is not correct)
Grid.update(:page_id => @page_id,:thing_id => @thing_id,:number => @number 开发者_C百科).where(:page_id => @page_id, :number => @number ).first
I need to find the record with mathing page_id and number, and then update the thing_id.
Thanks! Jakob
Grid.where(:page_id => @page_id, :number => @number).first.
update_attributes(:page_id => ...,: thing_id => ..., :number => ...)
精彩评论