Ruby on Rails developers are those to catch some of the highest paid jobs in the market.
Ruby on Rails has been the choice of the companies with huge customer base like Github, Shopify, Basecamp, Twitter, Slideshare, Kickstarter, Soundcloud, Dribble and the list is really big.
The hourly charge of an experienced independent Ruby on Rails developer is about $150-$200 and that is much more than other developers get paid these days. Also the junior Ruby on Rails developers, the average hourly rate lies anywhere in two digit figures.
Rails is a framework built on Ruby. Ruby is very interesting language and it was designed to make the programmers happy. You should have basic knowledge of Ruby before you dive in for Rails. If you don’t have any prior programming experience, Ruby can be your first programming language. It is a simple language. Some of the best places to learn Ruby online are Learn Ruby the Hard Way and Treehouse Ruby course.
Rails was created by founder of Basecamp, David Heinemeier Hansson. Hansson first released Rails as open source in July 2004. He had been using the PHP programming language because he could get things done quickly but was frustrated because of a lack of abstraction and frequently repetitive code that made PHP “dirty.” In the last, after Java, he tried Ruby and he was very happy about the ease of use found in Ruby.
Rails is model-view-controller framework. It is designed to make programming web applications easier by making assumptions about what every developer needs to get started. It allows you to write less code while accomplishing more than many other languages and frameworks. Experienced Rails developers also report that it makes web application development more fun.
The Rails philosophy includes two major guiding principles:
- Don’t Repeat Yourself: DRY is a principle of software development which states that “Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.” By not writing the same information over and over again, our code is more maintainable, more extensible, and less buggy.
- Convention Over Configuration: Rails has opinions about the best way to do many things in a web application, and defaults to this set of conventions, rather than require that you specify minutiae through endless configuration files.
Create your first application with Rails
After installing Ruby on Rails on your computer, you can open the terminal and enter the following command:
rails new my-first-app
It will create the directory, my-first-app. It will have various auto-generated files and folders that make the structure of the Rails application. The structure of the Rails app is explained as below:
|app/||Contains the controllers, models, views, helpers, mailers, channels, jobs and assets for your application. You’ll focus on this folder for the remainder of this guide.|
|bin/||Contains the rails script that starts your app and can contain other scripts you use to setup, update, deploy or run your application.|
|config/||Configure your application’s routes, database, and more. This is covered in more detail inConfiguring Rails Applications.|
|config.ru||Rack configuration for Rack based servers used to start the application.|
|db/||Contains your current database schema, as well as the database migrations.|
|These files allow you to specify what gem dependencies are needed for your Rails application. These files are used by the Bundler gem. For more information about Bundler, see the Bundler website.|
|lib/||Extended modules for your application.|
|log/||Application log files.|
|public/||The only folder seen by the world as-is. Contains static files and compiled assets.|
|Rakefile||This file locates and loads tasks that can be run from the command line. The task definitions are defined throughout the components of Rails. Rather than changing Rakefile, you should add your own tasks by adding files to the lib/tasks directory of your application.|
|README.md||This is a brief instruction manual for your application. You should edit this file to tell others what your application does, how to set it up, and so on.|
|test/||Unit tests, fixtures, and other test apparatus. These are covered in Testing Rails Applications.|
|tmp/||Temporary files (like cache and pid files).|
|vendor/||A place for all third-party code. In a typical Rails application this includes vendored gems.|
|.gitignore||This file tells git which files (or patterns) it should ignore. SeeGithub – Ignoring files for more info about ignoring files.|
Ruby community has created thousands of reusable packages which can be integrated in your code. It is called a ‘gem’. RubyGems.org is the Ruby community’s gem hosting service. It is a package manager for Ruby that provides a standard format for distributing Ruby programs and libraries through ‘gem’, a tool designed to easily manage the installation of gems, and a server for distributing them.
gem install mygem
gem uninstall mygem
Listing installed gems:
gem list –local
The Rails Way
Rails community is very active for integrating the best programming principles and technologies into the framework. Rails was the one of the first framework to integrate RESTful design principles and to implement the famous VCS (Version Control System), Git, in its early days. Rails community believes in refactoring the code, automated testing(TDD/BDD), DRY(Don’t Repeat Yourself), SOLID principles and coding styles.
Some of the best resources to learn Ruby on Rails are:
Some of the best books to become better at coding principles are:
Developers to Follow Online
You can interact or keep the track of some of the best Ruby/Rails developers. We can learn a lot from their code, their article or presentations. You can improve your code by looking at ‘the perfect code’ written by these developers. We can find their code on Github through the project their contribute to.
- Sandi Metz
I’m a programmer, and the author of Practical Object-Oriented Design in Ruby (POODR) and 99 Bottles of OOP. She believes in simple code and straightforward explanations.
- Avdi Grimm
Software developer. Host of Ruby Tapas webcasts. Part of the Ruby Rogues podcast. Author of Objects on Rails.
Blog, Twitter, GitHub
- Aman Gupta
San Francisco-based developer. Ruby core committer. Creator of tools including rbtrace, perftools.rb, stackprof, and gctools.
- Eric Hodel
Senior developer at AT&T Interactive. Ruby committer. Maintains RubyGems, RDoc.
- Charles Nutter
Senior principal software engineer at Red Hat Software. Speaker, core team on JRuby. Led the open source LiteStep project in the 1990s.
Blog, Twitter, GitHub
The best way to learn coding is to code! Happy Coding