simple_form f.hidden_​​field有效,为什么不f.input?

时间:2012-12-14 23:35:04

标签: ruby-on-rails simple-form

= simple_form_for @foo do |f|

  # this works
  = f.hidden_field :asdf, :value => @some.thing

  # this works
  = f.input :asdf, :as => "hidden", :input_html => { :value => @some.thing }

  # Why doesn't this work, exactly?
  = f.input :title, :as => "hidden", :value => @some.thing

当我查看我的日志时,我发现该值在后一个输入中以空字符串形式出现,但我不清楚为什么会发生这种情况。

1 个答案:

答案 0 :(得分:9)

f.hidden_fieldActionView::Helpers::FormHelperf.input属于SimpleForm

语法类似但有一些差异。