Rails,选择助手,添加样式 [英] Rails, select helper, adding style

查看:31
本文介绍了Rails,选择助手,添加样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试做这样的事情.

I'm trying to do something like this.

 select :model, :attribute, :style => "some:style;" 

style 添加到 rails 中的 select helper,但它不起作用.

Add style to the select helper in rails, but it is not working.

推荐答案

来自 文档:

select(object, method, selection, options = {}, html_options = {})

所以你的 :style 哈希需要是第 5 个参数.例如:

So your :style hash needs to be the 5th parameter. For example:

select(:model, :attribute, @options_for_select, { }, { :style => 'some: style' }

这篇关于Rails,选择助手,添加样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆