在我们的 Rails 3.2.8 引擎中加载 simple_form 时,simple_form 初始化文件 simple_form.rb 会导致错误:
/config/initializers/simple_form.rb:2:in `<top (required)>': uninitialized constant SimpleForm (NameError)
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:587:in `each'
在引擎的 config/initializers 下,simple_form.rb 是:
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a
# complete input. You can remove any component from the
SimpleForm.setup do |config|
导致错误。试图添加引擎名称规范,RfqxEmc::SimpleForm.setup do |config|
错误是一样的。
在 Rails 引擎中安装/加载 simple_form 的正确方法是什么?