Reputation: 1365
I installed ruby 2.0.0 and ran
gem install rails
to install gems. It installed all gems properly. For my existing rails app, I ran "bundle install" command and then typed this command in terminal:
rails s
to start webrick server.
But server failed to start and i am getting this error:
/usr/lib/ruby/vendor_ruby/railties/lib/rails_generator/options.rb:32:in `default_options': undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError)
Can anybody tell why this error is comming? And how to get rails server up and running? Thanks.
Upvotes: 2
Views: 910
Reputation: 321
I got this error from rails runner when it used the default Rails 2.3.11 version provided by my service provider instead of the intended Rails 4.0.1 version. However, prefixing the command line with 'bundle exec' solved the problem. This works for me:
bundle exec rails runner 'puts "Hello!"'
Upvotes: 0
Reputation: 11421
to install rails 4.0:
gem install rails --version 4.0.0 --no-ri --no-rdoc
http://weblog.rubyonrails.org/2013/6/25/Rails-4-0-final/
Note!, for better ruby versions management you would want to use RVM:
then install ruby:
http://rvm.io/rubies/installing
after installing rvm and ruby you can switch between ruby versions with:
rvm use 1.9.3
or other ruby version you have installed, to see what ruby versions you have, run:
rvm list
after switching yo your desired ruby version, you can install rails:
gem install rails --version 4.0.0
or another rails version that you need.
A nice tutorial here:
http://railsapps.github.io/installing-rails.html
Upvotes: 2