laertiades
laertiades

Reputation: 2012

rails generate uses wrong version of Ruby

I am developing a Rails app using RVM. I have the following in Gemfile:

source 'https://rubygems.org'
ruby '2.1.4'
#ruby-gemset=mpclub_4_1

gem 'rails', '4.1.0'

rails s works fine and gives the following:

[2014-12-30 15:14:47] INFO  ruby 2.1.4 (2014-10-27) [x86_64-linux]

ruby -v gives:

ruby 2.1.4p265 (2014-10-27 revision 48166) [x86_64-linux]

However, rails generate model Download gives:

Your Ruby version is 2.1.2, but your Gemfile specified 2.1.4

My question is: How do I run the rails generate command? Where is ruby 2.1.2 coming from? Any help troubleshooting this would be appreciated.

Upvotes: 1

Views: 183

Answers (2)

Mr. Rene
Mr. Rene

Reputation: 1335

Just tell rvm which version of ruby

which ruby

then

rvm use ruby-2.3.1

Upvotes: 1

warzon
warzon

Reputation: 187

Check if the file in which rails is picking ruby from the correct ruby location. Sometimes it might be pointing to the default ruby installation i.e /usr/bin/ruby rather than the rvm installation of ruby.

I personally use rbenv(in case you wanna try out an alternative)

Upvotes: 1

Related Questions