Some Rails 5.1 features are listed below:
It requires Ruby 2.3.1 or greater version of ruby.
No More RAKE Commands
When we want to run a migration in Rails 4 we need to type rake db:migrate, but in Rails 5.1
this will become rails db:migrate. In Rails 5.1 all the current rake commands will be accessible via the rails command.We can now restart all of our apps with the command rake restart.
In Rails 5.1 app, by default Puma server is present in Gemfile.
For an existing project, first we need to add the webpacker gem in Gemfile,then run the above command. In the same way we create the app for Angular and Vue.js.For more information on webpacker refer this link https://github.com/rails/webpacker.
New form_with helper
A new form_with helper has been added in Rails 5.1 which combines form_for and form_tag methods.
Direct and Resolved Routes
These two new methods direct and resolved has been added to the Routing DSL.
The direct method allows creation of custom URL helpers.
This will generate the singular URL /product instead of the usual /products/:id.
Now in mailers we can define before action by passing in parameters to the method. This parameters will be used for all methods in a mailer class, in order to share instance variables, headers and other common setup.
New Tag helper
The best solution for system tests on Ruby was using Capybara. Using it currently involves setting up Capybara in our project, along with a strategy for cleaning our database with tools like database_cleaner and launchy gem to help us to debug when an error happens.
Looking to get your app developed? RailsCarma can help! Check out our portfolio to understand how we are helping to change the shape of software industry by providing Ruby on Rails Developer. Get in touch with us now!