rails3.1和formtastic 2.0.0.rc2 - 未定义的方法`inputs'

时间:2011-06-16 21:43:03

标签: formtastic ruby-on-rails-3.1

我使用rails 3.1.0.rc3和formtastic 2.0.0.rc2,我收到此错误 -

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' }

这是一个错误吗?

谢谢,Alex

1 个答案:

答案 0 :(得分:2)

您正在尝试使用formtastic方法。当你实际上在Rails的表单构建器的块中时。

您需要在Gemfile中使用semantic_form_for和formtastic来使用f.inputs作为示例..