Question

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 method '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
Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top