引导程序:主题错误常量 NameError ->const_定义? [英] bootstrap:themed wrong constant NameError -> const_defined?
本文介绍了引导程序:主题错误常量 NameError ->const_定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试使用 Rails 3.2.2 运行以下程序,切换到 3.2.1 并尝试另一台机器,看看它是否与核心/操作系统相关.
Trying to run the following using Rails 3.2.2, switched to 3.2.1 and tried another machine to see if it was more core / OS related.
我尝试:
rails g bootstrap:themed events
我明白了:
.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/inflector/methods.rb:229:in `const_defined?': wrong constant name event (NameError)
from /Users/charleyhine/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/inflector/methods.rb:229:in `block in constantize'
from /Users/charleyhine/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/inflector/methods.rb:228:in `each'
from /Users/charleyhine/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/inflector/methods.rb:228:in `constantize'
from /Users/charleyhine/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
from /Users/charleyhine/.rvm/gems/ruby-1.9.3-p0/gems/twitter-bootstrap-rails-2.0.4/lib/generators/bootstrap/themed/themed_generator.rb:58:in `columns'
from (erb):6:in `template'
推荐答案
不需要降级 gem 版本.相反,只需更改:
No need to downgrade the gem version. Instead, just change:
rails g bootstrap:themed events
到:
rails g bootstrap:themed Events
您需要将模型名称大写和复数,这很愚蠢,但它有效
You need to capitalize and pluralize the model name, which is dumb, but it works
这篇关于引导程序:主题错误常量 NameError ->const_定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文