我在Rails环境中遇到了一些麻烦 - 运行如下命令:
$ rails generate scaffold_controller model_name
产生以下痕迹:
/Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/railties-3.2.13/lib/rails/generators/generated_attribute.rb:13:in `parse': undefined method `split' for :clear:Symbol (NoMethodError)
from /Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/railties-3.2.13/lib/rails/generators/named_base.rb:161:in `block in parse_attributes!'
from /Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/railties-3.2.13/lib/rails/generators/named_base.rb:160:in `map'
from /Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/railties-3.2.13/lib/rails/generators/named_base.rb:160:in `parse_attributes!'
from /Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/railties-3.2.13/lib/rails/generators/named_base.rb:21:in `initialize'
from /Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/railties-3.2.13/lib/rails/generators/resource_helpers.rb:18:in `initialize'
from /Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/thor-0.18.1/lib/thor/group.rb:227:in `new'
from /Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/thor-0.18.1/lib/thor/group.rb:227:in `dispatch'
from /Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from /Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/railties-3.2.13/lib/rails/generators.rb:171:in `invoke'
from /Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/railties-3.2.13/lib/rails/commands/generate.rb:12:in `<top (required)>'
from /Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/me/.rvm/gems/ruby-1.9.3-p392@myproject/gems/railties-3.2.13/lib/rails/commands.rb:29:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
由于跟踪中的任何内容似乎都不是来自我的具体项目,我对可能发生的事情感到有点困惑。如您所见,我在rvm安装的ruby 1.9.3上运行rails 3.2.13。
有什么想法吗?
答案 0 :(得分:0)
我遇到了同样的问题。事实证明我在代码中的某个地方有以下行。
include Term::ANSIColor
彩色术语输出需要此代码。但是当你需要生成或破坏支架时,可以暂时评论它。方法或符号&#39;清除&#39;与其他宝石发生冲突。所以这可能解决了rake:erd。