{"id":3050,"date":"2015-12-07T13:35:36","date_gmt":"2015-12-07T13:35:36","guid":{"rendered":"https:\/\/www.bacancytechnology.com\/blog\/?p=3050"},"modified":"2025-06-04T05:38:58","modified_gmt":"2025-06-04T05:38:58","slug":"rails5-an-easy-elegant-and-fun-way-to-build-web-applications","status":"publish","type":"post","link":"https:\/\/www.bacancytechnology.com\/blog\/rails5-an-easy-elegant-and-fun-way-to-build-web-applications","title":{"rendered":"Rails 5: Everything You Should Know About"},"content":{"rendered":"<p>From the very beginning, Rails has been praised as the productive way to get the Ruby on the web. It has always been considered as the easiest, fastest and the superior in so many ways. Ever since then, so many other alternatives have arrived, however Rails is still the industry leading framework for the Ruby developers.<\/p>\n<p>Just like the tradition, this April at RailsConf 2015 in Atlanta,the founder of Ruby on Rails, <a href=\"https:\/\/twitter.com\/dhh\" target=\"_blank\" rel=\"noopener\">David Heinemeier Hansson<\/a> (aka DHH) took the stage to pronounce what was new in Rails and to draw the attention on the release of Rails 5. This suits with the schedule for a major release every two years. So, let\u2019s have a look what BDFL had to say about the future of Rails.<\/p>\n<p>Here\u2019s a look at some of the significant highlights<\/p>\n<h2>TurboLinks 3<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.bacancytechnology.com\/blog\/wp-content\/uploads\/2015\/12\/railsturbolinks.jpg\" alt=\"TurboLinks 3\" width=\"760\" height=\"600\" class=\"aligncenter size-full wp-image-3051\"><\/p>\n<p>Here, DHH again reaffirmed his love for TurboLinks and their inclusion in Rails 5.<\/p>\n<p>TurboLinks is a process for making an application even faster by making use of JavaScript to replace portions of content instead of again reloading an entire page. However, TurboLinks may also make an application a bit heavier on client side JavaScript that could sometimes results in slowdowns and unresponsiveness. This is an actual reason, why some of the developers have actually struggled to get the performance improves as promised by the TurboLinks.<\/p>\n<p>TurboLinks have always been an essential part, since version 4; however version 5 is looking to take advantage of the more advanced TurboLinks 3. This simplifies the process and makes advanced use of middleware and HTML5 custom data attributes.<\/p>\n<p>If you are somewhat familiar with the functionality of TurboLinks in your application, no need to fret at all! Usually, things are not changing considerably. TurboLinks 3 is going to be a good evolutionary step towards better speed and superior rendering.<\/p>\n<h2>Action Cable<\/h2>\n<p>The most significant news at Rails Conf was the introduction of premier <a href=\"https:\/\/www.bacancytechnology.com\/blog\/build-real-time-chat-app-with-rails-5\" rel=\"noopener\" target=\"_blank\">Action Cable<\/a>. Action Cable is a significant feature used to extend Rails with the use of WebSockets to include realtime messages passing functionality.<\/p>\n<p>However, WebSockets is not a completely new concept and after lots of difficulties Rails has been finally fraught. Thus, it\u2019s a welcome addition for people who clearly not want to mess with the workarounds.<\/p>\n<p>Action Cable is still in the very beginning of development and there is likely to be more information on it is expected as a part of Rails 5. However, considering the amount of projects required in real time interaction, Action Cable seems to a standard advantage to Rails developers.<\/p>\n<h2>CoffeeScript<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.bacancytechnology.com\/blog\/wp-content\/uploads\/2015\/12\/coffee-script.png\" alt=\"coffee script\" width=\"450\" height=\"877\" class=\"aligncenter size-full wp-image-3053\"><\/p>\n<p>Love for CoffeeScript by DHH has also been reaffirmed here. Baked into Rails in version 3, CoffeeScript is designed as the default JavaScript while using the Rails. Thus, CoffeeScript has become &#8220;must use&#8221; for Rails developers,  specifically for devs that work on a large number of projects.<\/p>\n<p>It\u2019s been two versions; CoffeeScript has come into existence, still is the default and it has got a wider acceptance. For many, the fear of \u201cMustUse\u201d has not been panned out and for others, tried CoffeeScript and enjoyed it.<\/p>\n<p>One essential thing that can be sure of is: CoffeeScript is the default JavaScript flavour in Rails; this won\u2019t possibly be going away.<\/p>\n<h2>Ruby Version Support<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.bacancytechnology.com\/blog\/wp-content\/uploads\/2015\/12\/ruby.png\" alt=\"Ruby \" width=\"556\" height=\"656\" class=\"aligncenter size-full wp-image-3054\"><\/p>\n<p>Rails 5 only supports the version 2.2.1 and higher. As Ruby is progressing as a language, backwards compatibility is required to be sacrificed regarding new functions. The older version of Rails won\u2019t be supported indefinitely. Ruby on Rails is no different.  However, Rails is actually making the sensible decision of only encouraging the most preferred version, starting with 2. 2. 1 and including all stable releases after.<\/p>\n<p>As a result, it won\u2019t be possible that someone making use of Ruby1.9.3 would want to move to Rails 5. There are also possibilities that they will stick to a lower version until some other external factors force an upgrade along with the refactoring of the code. However, for some dev shops this won\u2019t be going to be happening for years, which is perfectly understandable.<\/p>\n<p>For a lot, this is somewhat a barrier to Rails 5. With regard to other people, it is an opportunity to improve an application which may be in need of some love.<\/p>\n<p>Due to latest version of Ruby in Rails 5, now Rails applications will have less memory consumption<\/p>\n<p>Rails 5 will only support Ruby 2.2.2 or better<\/p>\n<h2>MySQL ActiveRecord adapter gets JSON support<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.bacancytechnology.com\/blog\/wp-content\/uploads\/2015\/12\/MySql-sql.jpg\" alt=\"My SQL\" width=\"490\" height=\"896\" class=\"aligncenter size-full wp-image-3055\"><\/p>\n<p>If you happen to run your Rails application on top of MySQL 5.7.8 then your database have a new native JSON data type.<\/p>\n<p>Example:<\/p>\n<figure class=\"highlight\">\ncreate_table :json_data_typedo |t|<br \/>\nt.json :settings<br \/>\nend<\/figure>\n<p>Or method in ActiveRecord::Relation<\/p>\n<p>Finally ActiveRecord::Relation is getting #or method, this will allow us to write queries with ActiveRecord DSL as follows:<\/p>\n<p>Example:<\/p>\n<figure class=\"highlight warning\">\nUser.where(&#8216;status = 1&#8217;).or(User.where(&#8216;status = 3&#8217;))<br \/>\n\\# =&gt; SELECT * FROM books WHERE (status = 1) OR (status = 3)<\/figure>\n<p>Summary<\/p>\n<p>Ruby on Rails is completely upon us.<\/p>\n<p>It seems as though we have a lot to look forward: Turbolinks update for improved rendering, Action Cable for improved real-time message handling, more CoffeeScript as well as moving forward with the Ruby ecosystem.<\/p>\n<p>========================================================================<\/p>\n<p>Here at Bacancy Technology, we have in-depth knowledge and extensive experience of RoR developers. Being active RoR community members, we are always there to provide <a href=\"https:\/\/www.bacancytechnology.com\/rails-upgrade-service\" rel=\"noopener\" target=\"_blank\">Rails Upgrade Service<\/a>.<\/p>\n<p>If you are looking to <a href=\"https:\/\/www.bacancytechnology.com\/ruby-on-rails-development\">hire Ruby on Rails developer<\/a>, you can mail us your requirement at solutions@bacancytechnology.com .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>From the very beginning, Rails has been praised as the productive way to get the Ruby on the web. It has always been considered as the easiest, fastest and the superior in so many ways. Ever since then, so many other alternatives have arrived, however Rails is still the industry leading framework for the Ruby [&hellip;]<\/p>\n","protected":false},"author":43,"featured_media":52189,"comment_status":"open","ping_status":"open","sticky":false,"template":"blog-new-template.php","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"_lmt_disableupdate":"no","_lmt_disable":"","footnotes":""},"categories":[35],"tags":[],"coauthors":[1592],"class_list":["post-3050","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ruby-on-rails"],"acf":[],"modified_by":"Binal Prajapati","_links":{"self":[{"href":"https:\/\/www.bacancytechnology.com\/blog\/wp-json\/wp\/v2\/posts\/3050","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bacancytechnology.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bacancytechnology.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/blog\/wp-json\/wp\/v2\/users\/43"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/blog\/wp-json\/wp\/v2\/comments?post=3050"}],"version-history":[{"count":0,"href":"https:\/\/www.bacancytechnology.com\/blog\/wp-json\/wp\/v2\/posts\/3050\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/blog\/wp-json\/wp\/v2\/media\/52189"}],"wp:attachment":[{"href":"https:\/\/www.bacancytechnology.com\/blog\/wp-json\/wp\/v2\/media?parent=3050"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/blog\/wp-json\/wp\/v2\/categories?post=3050"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/blog\/wp-json\/wp\/v2\/tags?post=3050"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/blog\/wp-json\/wp\/v2\/coauthors?post=3050"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}