Gems are one of the most important part of Ruby on Rails. It helps speed up the development of website using Ruby on Rails and makes developers follow Ruby on Rails development standards.
We will mention some of the gems that a beginners should learn to enhance their skills and write better code.
1. Devise (Authentication)
Devise is very necessary gem that manages user authentication like login, signup and other features like password management, confirmation emails, locking account and also support for omniauth (Logging in via OAuth).
Some links:
- Gem Github Link - plataformatec/devise
- This is a really good basic setup guide - guide
2. Pundit (Authorization)
Pundit deals with Authorization, it handles what content should be accessible by the logged in user. To setup, we define a policy (rules) class for every model and define what the current user can access or take action.
Some links:
- Gem Github Link - pundit
- Documentation
3. Active Admin (Admin Panel)
Active admin builds a barebone admin panel with CRUD actions. It has a very basic design, implements filters, dashboard which can be customised and option to add comments in any of the model objects.
Some links:
4. Carrierwave and Fog (File upload)
Carrierwave provides support for file uploading in Rails, it has integrations with multiple gems like Fog (Uploading files to cloud providers) and Mini magic (ability to create multiple versions of image). With very minimalistic setup, you can add file uploading features to your app.
Some links:
- Gem Github Link - Carrierwave
- railscasts
5. Sidekiq (Background processor)
Sidekiq or background processor is required when we can't process CPU/Memory intensive scripts in Rails server like generating large reports. Sidekiq is a gem that helps you setup a background processor where you can transfer work from Rails server to background to prevent heavy process from slowing down you Rails web server.
Some links:
- Gem Github Link - sidekiq
- Here is a getting started guide - Getting-Started
6. Ransack (Query)
Ransack helps you to write simple (yet powerful) queries to get most use of your data present in Rails models. It is quite useful if you don't have knowledge of SQL.
Some links:
- Gem Github Link - ransack
7. Rspec (Test)
Writing test cases for your Ruby on Rails is quite useful and it makes your code more reliable and future proof. It is a behavior-driven development test framework which can help you test all aspects of MVC. It can be integrated with other gems like cucumber, capybara to make more use out of it.
Some links:
- Gem Github Link - rspec-rails
- Documentation - rspec.info
If you want us to write more details about any of these gems or want to learn some more gems, please comment below.
Vivek