I'm trying to Update a single record but I'm getting 'Wrong number of arguments' error.
I'm using Postman to try it out throught this url> localhost:3000/confirmations/32 (PUT Method)
My controller 'confirmation_controller'
def update
@confirmation = Invite.find(params[:id])
#if params[:estado] == 'Confirmar'
@confirmation.estado = 'Confirmado'
#elsif params[:estado] == 'Cancelar'
#@confirmation.estado = 'Cancelado'
#end
if @confirmation.update
@user = User.joins(:postulation).where(:postulation => {:id => @confirmation.postulation_id})
#Tengo que pasarle el usuario que le confirmo
UserNotifier.send_confirmation_to_user(@confirmation, @user)
end
end
My routes
resources :confirmations, only: [:index, :update, :edit]
The main idea is that the user will have a button 'Confirm' and when it is pressed will change the status of an invite. So I'm trying to simple update that field. I can't understand why I'm not able to get the param.
thanks a lot.
like someone said before, you should be using: @confirmation.save (or .save!)
http://apidock.com/rails/ActiveRecord/Base/save That will run through the model validations and save any changes to the object to db.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.