Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
445 views
in Technique[技术] by (71.8m points)

undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError)

I am working on rails, suddenly rails server stops working. It's working fine and I have used following command [platform windows 7]

gem install -v=2.3.5 rails

And when I use rails s, it's giving the following error:

c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator/options.rb:32:in `default_options': undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError)
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator/base.rb:90:in `<class:Base>'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator/base.rb:85:in `<module:Generator>'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator/base.rb:48:in `<module:Rails>'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator/base.rb:6:in `<top (required)>'
    from c:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from c:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator.rb:34:in `<top (required)>'
    from c:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from c:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/bin/rails:14:in `<top (required)>'
    from c:/Ruby193/bin/rails:23:in `load'
    from c:/Ruby193/bin/rails:23:in `<main>'

$ rails -v
Rails 2.3.5
$ ruby -v
ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had the same problem, but it was the result of having the gem rmagick.

I ran the following:

gem uninstall rmagick 
gem cleanup 

And then re-ran bundle in my stack and it worked for me again.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...