Essential & Useful Ruby Gems for Rails 4

Ruby on Rails framework is a powerful tool for building web applications. It is easy to learn and it comes with plenty of built-in functions which help to speed up the development of your web application such as an object-relation mapper and routing. Ruby on Rails uses the MVC pattern to organize application programming. Ruby gems makes development much easier. They are packaging systems designed to facilitate the creation and distribution of Ruby programs and libraries.

Check out some of the best Ruby on Rails gems for Rails 4. CarrierWave

Using this gem you can upload files in your applications. It store them on different back ends. It supports a variety of ORMs, frameworks and image processors such as ImageMagick and GraphicsMagick. CarrierWave keeps your code clean, reusable and it is easy to test.

To install :
$ gem install carrierwave
To add to your Gemfile:
gem “carrierwave”
To generate an uploder :
class AvatarUploader < CarrierWave::Uploader::Base storage :file end
The about command will give you a file in app/uploaders/image_uploader.rb Sidekiq

There are many gems for background processing, Sidekiq is the one of the most popular one and it uses threads to perform jobs at the same time in the same process and it is compatible with Resque. Sidekiq supports sending emails asynchronously with Action Mailer out of the box. The reason behind its popularity is the simplicity of its API.

Gem Installation : gem install sidekiq
Bullet

Bullet gem is designed to help you increase your application’s performance by reducing the number of queries it makes. It will watch your queries while you develop your application and notify you when you should add eager loading, when you are using eager loading that is not necessary and when you should use counter cache.Best practice is to use Bullet in development mode or staging mode.

Draper

Draper gem provides decorators which bundles view logic in an object oriented fashion. It helps make your views much cleaner and lets you avoid writing helpers To install Draper gem below line to your Gemfile:

gem “draper”, “~> 1.3”
PaperTrail

paper_trial gem is used to track your model changes for auditing, and it stores the pre change version of model. Also, it does not waste space storing a version of the object as it currently stands, PaperTrail stores the values in the Model Before column. Other auditing plugins store the after column. PaperTrail makes reverting to a previous version easy, PaperTrail can restore three types of associations: has_many_through, has_many, and has_one.

To install Paper Trial gem below line to your Gemfile:
gem “paper_trail”
Active Admin

Active admin is Ruby On Rails plugin. Using this framework you can create an admin interface to manage you data and this gem is highly customizable.it simple for developers to implement beautiful and elegant interfaces with very little effort. To install this gem add line to you gem file and run buldle install, after installing the gem, you need to run the generator. By default this gem is using Devise, and the generator creates an AdminUser model.

gem “activeadmin” # to install gem rails g active_admin:install   # creates the AdminUser class
Strong parameters

Rails 4 requires you to whitelist input values for your app. This feature is known as Strong Parameters. It adds an extra layer of security that prevents attackers from posting harmful or garbage information to your application.

To install Strong Parameters gem below line to your Gemfile:
gem “strong_parameters”
AxlsxRails

axlsx_rails provides a renderer and a template handler. It adds the: xlsx format and parses .xlsx.axlsx templates. This lets you take all the Axlsx code out of your controller or model and place it inside the template, where view code belongs, axlsx provides three options for initializing a spreadsheet:

1. xlsx_author (String) – The author of the document 2. xlsx_created_at (Time) – Timestamp in the document properties (defaults to current time) 3. xlsx_use_shared_strings (Boolean) – This is passed to the workbook to specify that shared strings should be used when serializing the package.
If you think RoR is a great option to build your application, get in touch with us to know how we can help you!

Subscribe For Latest Updates

Related Posts

Leave a Comment

Your email address will not be published. Required fields are marked *

en_USEnglish