23 useful Gems to start a Rails Application
One of the most useful things of Rails is the ability to add functionality through packed libraries called gems. From your development environment to production implementation, here is a non-exhaustive selection of 21 gems for Rails applications that are essential to the launch your project. The main goal here is to save your valuable time by eliminating the need to code the existing features.
You have to add the following Gems in your Gemfile, the group
:development so that you can benefit locally.
group :development do
These two gems are working to replace the Rails default error page to show you where the mistake was made, propose you a REPL (console), inspect
params, your instance variables and to easily browse stack of an error.
2. Pry Byebug –
Pry offers a colorful alternative to IRB and Pry Byebug helps to stop code execution with breakpoints, to offer you the opportunity to test/debug your application on the run.
3. Puma –
Puma is a faster HTTP server Webrick (proposed base on your Rails applications). This gem can increase the daily performance of your site and better manage any traffic load by addressing several requests in parallel.
4. Quiet Assets –
Quiet Assets allows you to relieve the log from your developer console by removing queries
HTTP related to the pipeline assets Rails. Say goodbye to multiple “GET /assets/blog/thumbnail-api-webhook-tutorial-be5d3373ac225d0d5d0f0060aa7b3eeb.jpg HTTP/1.1” 304 – 0.0154 and relieve your eyes.
5. Faker –
This is indispensable to populate your basis of false information (name, email, address …) when developing your application without the need to create everything by hand!
6. Letter Opener –
Letter Opener allows you to preview your emails directly in your browser without having to include a system for sending emails within your development environment.
You can add the following gems in your
Gemfile the group
:Production to only benefit when your application is Pushee on Heroku or any other service.
Group : Production do
7. 12factor Rails –
12factor rewrites some parameters of Rails to facilitate scalability and development regular update of your application according to the conventions of 12factor. This gem is primarily concerned with providing access to logs and also the folder
app/assets to be used in production in order to give access to your CSS, js and image files.
Some useful features
8. Bootstrap Sass –
This is very practical after you install this gem and imported the Bootstrap styles in
@import "bootstrap-sprockets"; and
@import "bootstrap"; then you’ll have access to all Bootstrap CSS framework via your HTML markup.
9. Simple Form –
Simple Form simplifies the creation of your forms with a very light syntax and gives you the ability to summon and customize the label elements, hints, errors and input according to your will.
<%= simple_form_for @user do |f| %>
<%= f.input :username, label: 'Your username please' %>
<%= f.input :password, hint: 'No special characters.' %>
<%= f.input :email, placeholder: '[email protected]' %>
<%= f.input :remember_me, inline_label: 'Yes, remember me' %>
<%= f.button :submit %>
<% end %>
Note that this gem is easily integrated with Bootstrap Foundation and through its installation options.
10. Currency & Omniauth –
Currency offers a complete authentication solution (Model, View, and Controller) reliable and secure. In addition to providing multiple users the ability to be connected at the same time, this gem can also be embellished module Omniauth to enable your users to connect to your service via Facebook Connect or Twitter.
11. Pundit –
Pundit provides a simple and centrally manage user permissions to your applications in
app/policies. You can duplicate this file all your controller classes accompanied by Policy suffix. Then set the rights of your
current_user each class method.
12-14. Paperclip, Carrierwave & Dragonfly –
These three gems with slightly different functions are proposing to manage the upload and processing of your images. On one side, Paperclip and Carrierwave will take care of resizing then store the original file and all necessary in resizing your template of the same image.
On the other side, Dragonfly. This gem stores the original version at first and resizes on the fly for each user action. This requires the installation of a cache refill images to minimize server load.
15. Gibbon –
16. Google Maps for Rails –
Gmaps4rails allows you to quickly customize your Google Maps to include markers and dynamic information windows.
17. Kaminari –
Kaminari provides complete and fully customizable pagination. Once installed, all your models can be paginated without any action required on your part towards models and helpers.
18. High Voltage –
High Voltage allows you to easily manage your static pages. After installation, you can simply create a folder
pages in your
views and place your pages. No configuration rooting, no helpers to create, or controller. Everything is taken care of for you!
19. Figaro –
Figaro lets you enhance the security of your application by hiding tokens, passwords and other credentials of APIs to prevent Git store (and thereby to everyone have access). You can still have access via the environment variable
20. Rails-i18n –
You can translate and locate your site quickly thanks to rails-i18n. Write all your translations in files
yml placed in
config>locals and call them in your views according to the language selected by your users.
21. Cocoon –
Cocoon allows easier management of nested forms allowing to create, destroy, update all models involved in a single view.
22. Active Admin –
All directors of your service are not necessarily developers, and, therefore, can not be content with a
heroku run bundle exec rails c. Active Admin to create a full management interface and easily customizable with all the functionality of your application.
23. Sidekiq –
Sidekiq is one of the gems worker management, to perform the heavy processing of your application in asynchronous processes, put in a queue. Since Rails 4.2, a unified framework, ActiveJob is available. Sidekiq is consistent with this approach. An example of using Sidekiq is sending an email to 10 users. If you perform this action in a controller, the user will wait long as treatment is done and have a feeling of slow navigation. If you unload this treatment in a sidekiq worker, you may return a web page to your user quickly by entrusting to the long Sidekiq task.