【问题标题】:rails3.1 and formtastic 2.0.0.rc2 - undefined method `inputs'rails3.1 和 formtastic 2.0.0.rc2 - 未定义的方法“输入”
【发布时间】:2011-06-16 21:43:02
【问题描述】:

我正在使用带有 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' }

这是一个错误吗?

谢谢,亚历克斯

【问题讨论】:

    标签: formtastic ruby-on-rails-3.1


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多