Search code examples
ruby-on-railsrbenv

Ruby on Rails - Cannot change Ruby version


I'm a begginer of Programming. I cannot change Ruby version.

The following is my Ruby version.

ruby -v

ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin14.0]

But, The followig command returns error because of wrong Ruby version.

rails generate scaffold User name:string email:string

Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2

If you can solve the problem, Please tell me. Thanks in advance.


Solution

  • Are you using rvm or rbenv? Check for the current version. To change current version do rvm use 2.1.2 or rbenv local 2.1.2 or create a .ruby-version file with 2.1.2 in it.