我正在尝试安装Flowplayer帮助程序gem,以便在Rails 3.1应用程序中使用,并通过RVM在OSX Lion上安装Ruby 1.9.3。
gem install flowplayer
正常完成,
也是如此 echo "gem 'flowplayer'" >> Gemfile
bundle install
当我尝试运行rails g flowplayer
我明白了:
/Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/flowplayer-0.1.2/lib/flowplayer/railties/generator/install_generator.rb:3:in `<module:Generator>': uninitialized constant Flowplayer::Rails::Generators (NameError)
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/flowplayer-0.1.2/lib/flowplayer/railties/generator/install_generator.rb:2:in `<module:Flowplayer>'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/flowplayer-0.1.2/lib/flowplayer/railties/generator/install_generator.rb:1:in `<top (required)>'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/flowplayer-0.1.2/lib/flowplayer/railtie.rb:6:in `block in <class:Railtie>'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/railtie.rb:194:in `call'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/railtie.rb:194:in `block in load_generators'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/railtie.rb:194:in `each'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/railtie.rb:194:in `load_generators'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/engine.rb:402:in `block in load_generators'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `each'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `all'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/engine.rb:402:in `load_generators'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/application.rb:109:in `load_generators'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/generators.rb:331:in `load_generators_from_railties!'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/generators.rb:289:in `lookup'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/generators.rb:149:in `find_by_namespace'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/generators.rb:166:in `invoke'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/commands/generate.rb:12:in `<top (required)>'
from /Users/mike/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/commands.rb:28:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
非常感谢任何见解!
答案 0 :(得分:1)
我通过monkeypatching ~/.rvm/gems/ruby-1.9.2-p290@flowplayer/gems/flowplayer-0.1.2/lib/flowplayer/railties/generator/install_generator.rb
文件躲过了这个问题。
我已将其改为:
module Flowplayer
module Generator
class InstallGenerator < Rails::Generators::Base
(...)
end
end
end
为:
module Flowplayer::Generator
class InstallGenerator < Rails::Generators::Base
(...)
end
end
不知道为什么,但它确实有效。