Reputation: 1
There were so many questions on this topic but none could help me to solve the issue.I am new to ROR. I am trying to run following command
rake db:create
it throws error though I have ruby 2.2.1 installed and by default it is pointed to
Your Ruby version is 1.9.3, but your Gemfile specified 2.2.1
I tried running following commands to check which ruby version is being used
ubuntu@myserver:~/workspace/railpro/appraiser-events/bin$ ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
ubuntu@myserver:~/workspace/railpro/appraiser-events/bin$ which ruby
/home/ubuntu/.rvm/rubies/ruby-2.2.1/bin/ruby
ubuntu@myserver:~/workspace/railpro/appraiser-events/bin$ echo $PATH
/home/ubuntu/.rvm/gems/ruby-2.2.1/bin:/home/ubuntu/.rvm/gems/ruby- 2.2.1@global/bin:/home/ubuntu/.rvm/rubies/ruby- 2.2.1/bin:/home/ubuntu/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/ usr/bin:/sbin:/bin:/usr/games:/usr/local/games
This shows that i am using ruby 2.2.1 and in my Gemfile also it points to 2.2.1 but when I use rake db:create it throws this error.
When I tried to change the Gemfile to point to 1.9.3 it said the reverse
Your Ruby version is 2.2.1, but your Gemfile specified 1.9.3
I tried putting a .ruby-version file in the top level directory and mentioned the 2.2.1 inside that but it didn't work
Upvotes: 0
Views: 553
Reputation: 34318
Run with bundle exec:
bundle exec rake db:create
This will ensure that the rake command is executed in the context of the current bundle.
Upvotes: 1