Rails button_to - applying css class to button

Deadly 提交于 2019-11-29 09:05:26

The signature of the method button_to is

button_to(name = nil, options = nil, html_options = nil, &block)

So use {} to distinguish options and html_options

<%= button_to "Claim", {action: "claim", idea_id: idea.id, remote: true}, {class: 'btn btn-small'} %>

<%= button_to "Claim", {action: "claim", idea_id: idea.id, remote: true}, {form_class: 'form', class: 'btn btn-small'} %>

form_class: class for the form

class : class for button in the form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!