Finally I’m going to start work on RoR. After spending one and a half month on CodeIgniter i.e php framework, I’m going to work on something new, something more powerful, something that I never experienced before. Whenever I search about Ruby On Rials I always found positive review about this framework. That’s the reason I’m going to dive in it. NO. Maybe this is the one of the reason but I really want to taste it. I have little experience with Django framework, recently experienced with CodeIgniter  and now it’s time to taste RoR :).

RoR Installation :

I’m using
Rails 4.1.4, Ruby 2.1.2p95, Rubygems 2.4.1

CAUTION : Don’t use apt-get to install ruby as I install outdated version of ruby.

  1. Curl Installation  :
    $ sudo apt-get update
    $ sudo apt-get install curl
  2. Install Ruby Using RVM ( Ruby Version Manager )

    $ \curl -L https://get.rvm.io | bash -s stable --ruby

    Note the backslash before “curl” (this avoids potential version conflicts).

    The “–ruby” flag will install the newest version of Ruby.

    If You Already Have RVM Installed :

    $ rvm get stable --autolibs=enable
    $ rvm install ruby
    $ rvm --default use ruby-2.1.2
  3. Install Node.js :
    Since Rails 3.1, a JavaScript runtime has been needed for development on Ubuntu Linux. The JavaScript runtime is required to compile code for the Rails asset pipeline.
    $ sudo apt-get install nodejsIf you don’t install Node.js, you’ll need to add this to the Gemfile for each Rails application you build:

    gem 'therubyracer'
  4. Check the Gem Manager

    $ gem -v
    2.4.1
    
    In order to update gem if necessary use 
    
    $ gem install rubygems-update
  5. RVM Gemsets :

    $ rvm gemset list
    
    gemsets for ruby-2.1.2
    => (default)
       global

    Only the “default” and “global” gemsets are pre-installed.
    If you get an error “rvm is not a function,” close your console and open it again.

  6. RVM’s Global Gemset :
    $ rvm gemset use global
    $ gem list
    

    You’ll see a lots of pre-installed gems. Like blunder, rake, rvm etc.

    To get a list of gems that are outdated:

    $ gem outdated

    To update all stale gems:

    $ gem update
  7. Rails Installation Options :
    You can install Rails directly into the global gemset. However, many developers prefer to keep the global gemset sparse and install Rails into project-specific gemsets, so each project has the appropriate version of Rails.Instead, make a gemset just for the current stable release:

    $ rvm use ruby-2.1.2@rails4.1 --create
    

    If you want the most recent stable release:

    $ gem install rails
    $ rails -v
  8. Create New Rails Project :$ rails new Project_Name
    $ cd Project_Name
    $ bin/rails server
    $ Open link in browser http://localhost:3000

This is all about installation. I just start learning RoR, whatever I learn in coming days i’ll keep on posting, Stay tuned.

Sublime-Text-Editor :
Sublime is one of my best editor. After VIM, this is the editor whom to I feel in love ;). I found some good stuff which make work more easy.

  1. Package Manager/Controller
    Click here. After installation press Ctrl+Shift+P and type “install package” and Install whatever package you want like HTML5 snippet and all.
  2. LiveReload 
    This is one of my best package.  Now, there is no need to refresh your browser each time you make the changes to the file with this plugin installed. Just hit save on the editor and browser will automatically refresh the page for you. Press Ctrl+Shift+P and type “install package”. When it’s done then type LiveReload. In order to add browser extension ( which is must ) click here.
  3. Emmet
    In a nutshell, Emmet allows us to write HTML and CSS faster with abbreviations/shortcuts, then expand them in valid HTML tags.
  4. CanIUse
    With this plugin, you can check the browser support for CSS properties and HTML elements that you are using.
Advertisements