3

我正在使用带有formtastic 2.0.0.rc2的rails 3.1.0.rc3,我收到了这个错误-

undefined method `inputs' for #<ActionView::Helpers::FormBuilder:0x000001059c2fb0>

这是代码块

 = form_tag '#', :class => 'formtastic' do
  = fields_for CustomFields::Field.new, :builder => Formtastic::Helpers::FormHelper.builder do |g|
    = g.inputs :name => :attributes do
      = g.input :_alias
      = g.input :hint
      = g.input :text_formatting, :as => 'select', :collection => options_for_text_formatting, :include_blank => false, :wrapper_html => { :style => 'display: none' }
      = g.input :target, :as => 'select', :collection => options_for_association_target, :include_blank => false, :wrapper_html => { :style => 'display: none' }

这是一个错误吗?

谢谢,亚历克斯

4

1 回答 1

2

您正在尝试在这里使用一种形式化的方法。当您实际上处于 Rails 的表单构建器的块中时。

例如,您需要 Gemfile 中的 semantic_form_for 和 formtastic 才能使用 f.inputs 。

于 2011-08-21T09:40:36.737 回答