Social Marketing

With Ror, watch out to never repeat in your code !

One of the great ideas of Rails is DRY, Do not Repeat Yourself ! Rails provides the architecture and tools needed to avoid duplicating code unnecessarily for the developers . To them to play the game up to the end. To repeat in the code is a wound : what to make if the code in question needs to change? Here you have to change all the rehearsals, which really is not easy when you accumulate many files throughout your project. So avoid repeating yourself.

There are two ways to repeat least, thanks to helpers and gems.

The helpers

Rails helpers are tools that enable sharing of Ruby code between the different views. The interest is to make lighter HTML files by moving the recurring code in a helper.

The gems

The gems are products code modules by other developers that provide functionality to your Ruby Savvy application - they are not limited to Rails. Rails itself uses some gems. The list of gems used is in the Gemfile to the root of your application. When adding a gem in Gemfile, you must download and install. These two things are done automatically with the bundle install command to the terminal. The gems are then uploaded to the site indicated in the front line of Gemfile the source. This line almost never changes. When you download an application written in Ruby, the first thing to do, is to look if there is a Gemfile. If this is the case, make a bundle install.

Rails guides developer

Rails provides many scripts for generating skeletons of these code.All these tools are based on the naming conventions of Rails and file organization.

- Project generation Script
- Model Generation Script
- Controller Generation Script
Rails provides by default a number of code generators (model, controller, webservice , mailer ... ).

Contact the best ruby on rails development company here !

Say what you think.

Les publications similaires de "SEA blog"

  1. 15 Juin 2017Have a free test drive now !292 clics