Specify RVM Gemset for Each App

Using rvm is always a bit confusing for me – I never fully understand exactly how its working. One thing I learned recently was how to specifcy a specific gemset for an app. I think when you refresh a terminal session, rvm switches back to the default gemset. I was upgrading to Rails 5, and I wanted to specificy to use my rails5.0 gemset with my app for testing. Here’s how you do it:

 rvm --ruby-version use 1.9.3@my_app

where my_app is the name of your gemset. This creates two files in the root of your application: .ruby-version and .ruby-gemset. These files specify the ruby version and gemset to use for your app.

Hope that makes sense, and if its wrong please let me know!

credit here, here, and here

Advertisements

Rails Generator Error Not Working, Not Creating Files

I had a really weird issue today, but was hard to debug because no actual error was thrown.

I would run the rails g model User and the output in Terminal looked normal, it says it created the files.

Screen Shot 2014-12-10 at 7.36.41 AM

However, when I checked the directory, no files were actually created. This was super frustrating and very weird.

I was able to find an answer from this SO question, although I have no idea why it works or what ‘spring’ is.

I first ran spring stop, then ran my migration, and it worked great.

If anyone knows more about this please share!