Ruby on rails 使用Twitter引导设置Rails按钮链接助手的样式

Ruby on rails 使用Twitter引导设置Rails按钮链接助手的样式,ruby-on-rails,twitter-bootstrap,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(

我正在使用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'} %>
{:class=>'btn.btn large.btn primary'})%>
{:class=>'btn.btn large.btn primary'}%>
这是facebook按钮的页面来源

<form action="/users/sign_up" class="button_to" method="post"><div><input html="{:class=&gt;&quot;btn.btn-large.btn-primary&quot;}" 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=&gt;&quot;btn.btn-large.btn-primary&quot;}" type="submit" value="Sign Up" /><input name="authenticity_token" type="hidden" value="QIvZqd9BRV8TMspMvckAUjhC68nm3NTyQCxVRHFA4PE=" /></div></form>

知道我做错了什么吗


您只需要
:class=>“foo”
来设置按钮的类,而不是
:html=>{:class=>“foo”}
。所以它应该是这样的:

<%= button_to('Sign Up', new_user_registration_path, :class => 'btn btn-large btn-primary')  %>
“btn btn大型btn主节点”)%%>

这将生成您的大型主按钮。

上面的答案对我来说几乎可以修复,但需要将
按钮更改为
链接。也摆脱了火箭<代码>=>

<%= button_to('Sign Up', new_user_registration_path, class: 'btn btn-large btn-primary')  %>


我用一个显示类如何附加到输入元素的图像更新了OP。有什么线索吗?它需要类之间的空格:class=>“btn btn large btn success”它是这样工作的。Twitter引导使用空格而不是点。我已经提交了对原始帖子的编辑,但需要先得到批准。我的意思是,哈希火箭应该仍然有效,它只是一个语法问题。但我不知道将
按钮更改为
是什么意思,因为您的代码片段甚至没有
链接到