【问题标题】:Formtastic Unable to find input classFormtastic 找不到输入类
【发布时间】:2015-03-09 06:56:53
【问题描述】:

尝试使用 Formtastic 创建自定义输入元素。从非常简单的事情开始:

app/input/card_body_input.rb

class CardBodyInput < FormTastic::Inputs::Base
    include Base

    def input_html_options
      {
        :cols => builder.default_text_area_width,
        :rows => builder.default_text_area_height
      }.merge(super)
    end

    def to_html
      input_wrapping do
        label_html <<
        builder.text_area(method, input_html_options)
      end
    end

  end

我尝试这样使用它:

f.inputs do 
  f.input :back_content as: :card_body
end

我收到了Unable to find input class for card_body

有什么想法吗?谢谢。

【问题讨论】:

  • 是的,这就是我在上面分享的内容。
  • Rails 项目在哪里放置了 CardBodyInput 类的文件? (需要 Rails 根目录的相对路径)
  • 应用程序/输入 - 根据 Formtastic 自述文件中的说明。
  • 你的文件的文件名是...?

标签: ruby-on-rails ruby formtastic


【解决方案1】:

你把你的文件放在app/input;应该是app/inputs

【讨论】:

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