SimpleForm输入元素的自定义标题

时间:2013-04-20 17:14:29

标签: ruby-on-rails-3 simple-form

如何将自己的名称添加到输入中,例如一个文本框? 即如何自定义输入旁边显示的输入名称?

这是我的代码:

- title "Add a NEO"

= simple_form_for @neo do |f|
    = f.input :name
    br
    - for obs in @observations do
        = simple_form_for obs do |o|
            table 
                tr
                    td = o.input :ra
                    td = o.input :dec
    = f.button :wrapped, "Create NEO"

我想为o.deco.ra指定文字。我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

- title "Add a NEO"

= simple_form_for @neo do |f|
    = f.input :name
    br
    - for obs in @observations do
        = simple_form_for obs do |o|
            table 
                tr
                    td = o.input :ra, :label => "Right Ascension"
                    td = o.input :dec, :label => "Declination"
    = f.button :wrapped, "Create NEO"