Rails new release seems like moving to a new home, thus is true with Rails new version Rails 5 release. Rails 5 is one of the best releases of Rails in the today’s technological world. Claudio Baccigalipo too announces that Rails 5 is all the more inviting, particularly to newcomers.
The indistinguishable Ruby companion Rails as of late had another new version release. As indicated by the software/product quality organization TIOBE July 2016 index, Ruby stands eleventh in this rundown of commonly used and most prevalent languages. Look at the whole review here. On June 30, 2016, Rails 5 would celebrate its version release. To boot, this procedure spread over six months with four beta versions and two release candidates. Ruby 2.2.2 is the base necessity for utilizing Rails 5.0. Before proceeding onward to Rails 5.0 upgrade to Rails 4.2 and check if the application still works, as a precautionary step. If you are simply beginning with Rails, Have a look at this link. Let’s take a gander at the principal changes in Rails 5.0:
Activity Cable: Featuring WebSockets
- The new framework incorporates WebSockets with Rails. Now, Real-time components are permitted to be written in Ruby. Perused more about WebSockets here.
- While still adaptable and performant, like rest of the Rails applications, the features are written in a similar form and style.
Active Record traits API: User Defined Custom Types and much more
- An attribute with a defined model type. The existing characteristics/traits would be countermanded if needed. When allocated to a model to and from SQL this license value conversion control.
- Much easier to manage record work in batches, thanks to Relation#in_batches and decrease memory overloads.
- Active Record callbacks require is not inadvertently ended due to the last false statement. You can now: prematurely end unequivocally.
- You don’t need to rely on implementation details or monkey fixing, for allowing domain objects utilization in ActiveRecord:: Base. Active Record permits type detection to be abrogated and attributes no longer need database column backing.
- Making Custom Types: Custom types can be user defined. The principal condition: they should react to value type characterized strategies. Helpful in the custom discussion, for example, Money data.
- Querying: For value to the SQL conversion Model class defined type is used when ActiveRecord:: Base is called, calling serialize on your type object. While performing SQL queries, objects specify and convert values.
- Dirty Tracking: This attribute type gives the opportunity to modify dirty tracking performance.
Programming interface Applications: A Base for APIs
- Thinned down API applications can be utilized to make and serve APIs like GitHub, Twitter, and so forth. Application Record is currently a default parent class of all generators made models.
- A programming interface (API) can be utilized for serving custom and public confronting applications. Configure applications with a constrained set of middleware than ordinary.
- ActionController: Make ApplicationControl acquired from ActionController: API rather than ActionController. Similarly, as with middleware, forget any Action controller modules that give functionalities principally utilized by browser applications.
- A base for APIs: Generators are to be configured to view generation, resources, and supporters even as a new asset is produced. The application gives a base to APIs. To pull in functionality the configuration is done, as is discovered appropriate to the application’s needs.
New and Improved Test Runner
Running test capacities on Rails is further improved with new test runner. Simply type bin/rails test to utilize this test runner. Test Runner is inspired from the maxi-test, mini-test reporters, RSpec, aside from others.
Notable Test Runner headways:
- Minitest integration provides options like -n for the specific test by name and -s for test seed data.
- Test’s colored output.
- Improved failure messages make re-running failed tests performance easy.
- A single test run using test’s line numbers.
- Multiple tests pinpointing the tests line number
- Test output deferred to the full test runs end, using -d option.
- The test can be posted instantly using the fail fast -f option in case of failure. You do not need to wait for suite completion.
- Utilize -b option for exception backtrace completion output.
Other striking Rails 5.0 additions: Features
- Enabled on Mac OS X and Linux new applications can be generated relating the evented file system
- Proxy Rake tasks carried and administered through bin/rails.
- New plugins and applications get md at Markdown.
- Restart Rails app through tmp/restart.txt.The bin/rails restart task has been appended for this purpose.
- Added bin/rails dev:cache to disable or enable development mode caching.
Rails 5 Summary
There is much more to the Rails 5 release. To rewind, a Rails application can be an implicit API mode in the back end, making it simple to assemble the back end. In the interim, different frameworks like React can assist you in the front end. The new Action Cable element empowers engineers to think out of the box, write applications with constant/real-time upgrades, particularly valuable in building chat applications. Take a gander at different Rails highlights in this link. Also perceive how JSON API functions with Rails 5 in this video.