Ask A Question

Notifications

You’re not receiving notifications from this thread.

The difference between Link_to vs Button_to in Ruby on Rails Discussion

Another trick is to use formaction for having multiple buttons in the same form without using any hidden forms.

For example:

<%= form_with model: @blog_post do [form| %> 
  <%= form. submit "Save" %>
  <%= tag.button "Publish", formaction: publish_blog_post_path(@blog_post) %>
<% end %>
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,329+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.