When I first started writing Rails applications I used .ruby-version because I read about it on the RVM website. I did this for two of my Rails applications. It was so long ago that I do not remember the commands that I typed to activate this. I have seven other applications where I do not use .ruby-version nor .rvmrc. All I did was assign a gemset (rvm use) to the application and they are working just fine.
Here is my situation. On my development server I was able to change the gemset to the one I want to use by doing rvm use 1.9.3@gemsetname --default. Once I did that I did a bundle update to make sure no gems were missing in the gemset. Afterwards I am still able to run the application. I then deleted the gemset that was in the .ruby-version. After deploying the application I am still able to use the website with no problem. However there is a different story on my production server. I can go through the same steps on the production server, including deleting the .ruby-version file, but somehow it still looks for the gem file that was in the deleted .ruby-version file. When I put the .ruby-version file back in the application I have to do a bundle update to install all the gems into the gemset that I attempted to delete. I'm sure there is something that I did on the production server that I must not have done on the development server that is causing this.
I want to change the two applications where it does not use .ruby-version at all like the other applications. My goal is to have one gemset for all my applications using the latest version of Rails 3.2 and to eventually create a second gemset for all Rails 4.0 applications.
I have tried to do a search on .ruby-version in Stack Overflow but cannot find any relevant posts about this. Maybe I'm just having a bad day because I'm sure someone has posted something about this over the years. I have tried to find the page where .ruby-version is discussed on the RVM website but cannot find it.
Any help is appreciated.
UPDATE 7/22 9:22 am CDT 0915 GMT-5
I remembered that on my development server I did the command below in preparation to eventually upgrade Ruby to Ruby 2.0.
gem update --system 2.0.3
gem update bundler
I had not done this on my production server. I just did both of these commands, selected the gemset I want to use then deleted the .ruby-version file. The application did not work. When I put the file back my application worked. When I do rvm gemset list it says it's using the gemset that I want to use in the future. Somehow I was able to get rid of the requirement for .ruby-version on my development server but not on my production server.
Here is the problem. This is what is contained in my .ruby-version file:
1.9.3@gemsetname
There was logic on the RVM website to set .ruby-version. I guess I had not set a gemset to use for the application so the system created a gemset with the name of my Rails application. I should have stated this earlier. I do not want the application to use the gemsetname it created.
You are using
.ruby-version
with gemsets - which is possible in rvm but not recommended, there is a separate file for the gemset:.ruby-gemset
and you should use this file for gemsets and leave.ruby-version
just for ruby version - which is recommended to keep in you code repository - for more details check this question: Should I check in `.ruby-gemset` and/or `.ruby-version`? along with this answer: https://stackoverflow.com/a/16738020/497756