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.
- 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).
- Gem Github Link - plataformatec/devise
- This is a really good basic setup guide - guide
- 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.
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.
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.
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.
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.
- Gem Github Link - ransack
- 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.
If you want us to write more details about any of these gems or want to learn some more gems, please comment below.