ruby-on-rails – simple_form f.hidden_​​field有效,为什么不f.input?

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – simple_form f.hidden_​​field有效,为什么不f.input?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_404_2@= 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,:value => @some.thing

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

解决方法

f.hidden_​​field是 ActionView::Helpers::FormHelper,而f.input属于 SimpleForm.

语法类似但有一些差异.

原文链接:https://www.f2er.com/ruby/264566.html

猜你在找的Ruby相关文章