Thursday 18 June 2015

What's new in Rails 4

Why Rails?
Expressiveness -  Rails is close to English
Convention over configuration -  Uses conventions which are easy to remember.
Easy for rapid web development
clean, elegant and easy to read because the code written in ruby speaks for itself
build on the philosophy "Don't reinvent the wheel"
Rails works with tools like Compass and Sass which made rails a favorite for designers.
Have lots of testing tools such as Capybara, Cucumber is another popular acceptance testing framework.
Write less do more philosophy

What's new in rails 4
  • It requires ruby 1.9.3 or higher version
  • To make rails app with specific version of rails than that can be done by the following command
    rails _version_ new app_name
  • Support for postgres datatype like tags, hstore
  • Rails 4 db:migrate commands shows only warning messages instead of log messages
  • Model.scoped is deprecated instead we can use Model.all
  • Model.none can be used to return a balnk active record relation, this might be useful when we want to use methods to operate on the data but should not returned.
  • Model.where.not(name: "Ajeet") this method will return the record which doesn't have name "Ajeet".
  • Another method Model.order() which now accpets the hash. ex. Model.oreder(name: :desc)
  • No need to make a new variable to mutate the changes in the fetched record. ex s = Model.all; will return all the record and to filter this result more specifically without storing them to a separate variable. lke s.where!(name: "Hello"); will result the record having name "Hello"

0 comments:

Post a Comment

 

Copyright @ 2013 Appychip.

Designed by Appychip & YouTube Channel