Lea*_*cim 10 ruby-on-rails twitter-bootstrap
我正在使用Rails助手来生成按钮,我正在尝试使用按钮的Twitter引导样式来设置按钮样式.我添加了带有:html选项的类.页面没有破坏,但样式没有显示.
<%= button_to('Sign Up', new_user_registration_path, :html => {:class => 'btn.btn-large.btn-primary'}) %>
<%= button_to "Sign Up", user_omniauth_authorize_path(:facebook), :html => {:class => 'btn.btn-large.btn-primary'} %>
Run Code Online (Sandbox Code Playgroud)
这是facebook按钮的页面源
<form action="/users/sign_up" class="button_to" method="post"><div><input html="{:class=>"btn.btn-large.btn-primary"}" type="submit" value="Sign Up" /><input name="authenticity_token" type="hidden" value="QIvZqd9BRV8TMspMvckAUjhC68nm3NTyQCxVRHFA4PE=" /></div></form>
<form action="/users/auth/facebook" class="button_to" method="post"><div><input html="{:class=>"btn.btn-large.btn-primary"}" type="submit" value="Sign Up" /><input name="authenticity_token" type="hidden" value="QIvZqd9BRV8TMspMvckAUjhC68nm3NTyQCxVRHFA4PE=" /></div></form>
Run Code Online (Sandbox Code Playgroud)
知道我做错了什么吗?

Jef*_*ith 18
您只需要:class => "foo"设置按钮的类,而不是:html => { :class => "foo" }.所以看起来应该是这样的:
<%= button_to('Sign Up', new_user_registration_path, :class => 'btn btn-large btn-primary') %>
Run Code Online (Sandbox Code Playgroud)
这将生成您的大型主按钮.