开发者

Undefined method update_attributes?

Im trying to allow the user to update the attributes for a single column for multiple elements based on a drop down (with name="status) but i keep getting back the error: undefined me开发者_开发百科thod 'update_attributes'. Any suggestions?

 def supdate
        @input_messages = InputMessage.find(params[:message_ids])
        respond_to do |format|
          if @input_messages.update_attributes(:status => params[:status])
          format/html { redirect_to :action => "show" }
          end
        end
  end


Assuming that your params[:message_ids] value is an array, then @input_messages will be an array of results instead of a single ActiveRecord object. You may need to do something like this instead:

@input_messages.each do |input_message|
  input_message.update_attributes(:status => params[:status])
end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜