Ruby on Rails is a full-stack web framework optimized for programmer happiness and sustainable productivity. It encourages beautiful code by favoring CoC (Convention Over Configuration). The Ruby on Rails team has released the latest version of Rails on December 3rd, 2013. Rails 4 includes some major enhancements compared to previous versions and if you still don’t aware of those features then this one is definitely for you
Here I have pinpointed some major features of Rails 4:
Rails 4 comes with a new innovative way of caching called Russian Doll caching, where we use nested fragment caches. In nested fragment caches, a page can be divided into a numerous segments and each segment being a fragment. These cached fragments are used independently and can be reused when the content changes. Changes to inner fragments cache expires only that cache and it will not affect the entire nested caches. Any changes to the most-nested fragment cache, caused a chain reaction which expires all outer fragment caches. Rails 4 uses caches digests to avoid the pain of maintaining cache version numbers for individual templates.
Rails 4 has a new way of dealing with mass assignment each basically pushes the responsibility out of the model and into the controller where it belongs. Whereas, in the previous version of rails, the method was to list the accessible fields in the models. Two advantages of strong_parameters are:
Enhances application Security by white-listing params.
Better control on controller level on user input.
Turbolinks are integrated in Rails 4, which makes our application faster. Turbolinks uses the HTML5 pushState API which allows JS to store arbitrary data in session history along with a page URL and page title. It uses the back() and forward() functions for navigation. It helps your app if it is css and js heavy.
Lives Streaming is one of the major feature in Rails 4. To enable streaming we need to mix in the ruby
to the controller class. One use case for this is to enable push notifications to the frontend without relying on plugins like Juggernaut or outside services such as Pusher.
Rails 4 has some other improvements added, such as custom flash types, jbuilder template handler and better test folder structure which makes it best suited for web app development. Some other features that you can check out from the blog “features available on Rail 4”