gpt4 book ai didi

ruby-on-rails - Bootstrap :themed wrong constant NameError -> const_defined?

转载 作者:行者123 更新时间:2023-12-04 03:52:28 25 4
gpt4 key购买 nike

尝试使用 Rails 3.2.2 运行以下程序,切换到 3.2.1 并尝试另一台机器以查看它是否与核心/操作系统相关。

我尝试:

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版本。相反,只需更改:

rails g bootstrap:themed events

到:

rails g bootstrap:themed Events

你需要将模型名称大写和复数化,这是愚蠢的,但它有效

关于ruby-on-rails - Bootstrap :themed wrong constant NameError -> const_defined?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9759347/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com