Search code examples
ruby-on-railspostujs

What's the function/meaning of the param named "commit" in a rails POST request?


What's the function/meaning of the param named "commit" in a rails POST request?

<ActionController::Parameters {"utf8"=>"✓", "user"=>{"email"=>"admin@example.com", "password"=>"password", "password_confirmation"=>"password"}, "commit"=>"Register", "controller"=>"users/registrations", "action"=>"create"} permitted: false>

Solution

  • The params[:commit] holds the value of the submit button, which is useful if you're using the same form for multiple actions, like 'Sign up' or 'Sign in' or something along those lines.