简体   繁体   English

样式下拉式红宝石

[英]Style dropdown ruby on rails

I'm new to ruby on rails. 我是红宝石的新手。 I have the problem that I can not apply the style to the following code: 我有无法将样式应用于以下代码的问题:

"<%= select(:pais, :codigo, Country.all.collect {|p| [ p.country, p.code ] }) %>" “ <%= select(:pais,:codigo,Country.all.collect {| p | [p.country,p.code]})%>”

I'm using metro-bootstrap and apply this in particular I want the "form-control" but not working class. 我正在使用Metro-Bootstrap并将其特别应用,我需要“表单控件”而不是工作类。 The rest of the stuff if you apply the class, but not in this code. 其余的东西,如果您应用该类,但不在此代码中。 probe in several ways, which do not generate the error but does nothing is this 以几种方式进行探测,不会产生错误,但是什么也不做

"<%= select(:pais, :codigo, Country.all.collect {|p| [ p.country, p.code ] }, :class => "form-control") %>" “ <%= select(:pais,:codigo,Country.all.collect {| p | [p.country,p.code]},:class =>” form-control“)%>”

but does not apply the style 但不适用样式

You need separate option like : 您需要像这样的单独选项:

select(object, method, choices = nil, options = {}, html_options = {}, &block)

Do as below: 执行以下操作:

<%= select(:pais,
           :codigo,
           Country.all.collect {|p| [ p.country, p.code ] },
           { :class => "form-control" }) %>

And read documentation carefully Form Helpers 并仔细阅读文档Form Helpers

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM