ddeveloperr
4/11/2015 - 6:42 PM

Ruby on rails snippets

Ruby on rails snippets

Basic Syntax
If you've already installed RVM, you should have the rvm command available to you. This is the way we call RVM.

The basic syntax of the command is:

rvm command_options command ruby_to_act_on
There are also RVM flags that can alter the behavior of RVM, which are given in a similar way to command options.

You can get a list of the available commands by typing:

rvm help
If you would like help on a specific command, you can reference it after "help" to get more detailed instruction:

rvm help command

Video guide: https://www.youtube.com/watch?v=cQVb7fHFjSM

********************************************************

Setting the default Ruby

If you would like to make one specific Ruby be the default ruby that is selected when you open a new terminal shell, use the --default flag:

$ rvm --default use 2.1.1

$ ruby -v

ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]
The next time you open a window Ruby 2.1.1 will be the selected ruby.

To switch back to your system ruby:

$ rvm use system

$ ruby -v

ruby 2.0.0p451 (2014-02-24 revision 45167) [universal.x86_64-darwin13]
To switch at any time to the ruby you have selected as default:

$ rvm default

$ ruby -v

ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]
To show what ruby is currently the selected default, if any, do:

$ rvm list

rvm rubies

 * ruby-1.9.3-p484 [ x86_64 ]
   ruby-2.0.0-p481 [ x86_64 ]
=> ruby-2.1.1 [ x86_64 ]

# => - current
# =* - current && default
#  * - default