Monday, July 8, 2013

Rails 4

I started reading about rails 4 and started working on a shopping cart application. here i am sharing few changes we need to do for running a rails 4 app.

http://ruby.railstutorial.org/chapters/sign-up?version=4.0#top.

The changes i seen that i am updating here
Rails 4 added a bin directory  
Which has Binary executable files.  

by default in gem files the turbolinks gem added
 # Turbolinks makes following links in your web application faster.
 # Read more: https://github.com/rails/turbolinks
 gem 'turbolinks'
  
To deploy on heroku you just need an heroku account. and just add your rails application to heroku.
an heroku by default uses a postgresql database.so this change is require to make in the database.yml file.  

One thing i can share about heroku is on heroku with a free plan there is restriction for each request and response for 30 seconds. so if the request time is more than this then an error will be shown.when you check a log of heroku

You can see different error code. which explains you what is the meaning of that error. you can see a table of this on following link
https://devcenter.heroku.com/articles/error-codes
for free plans you can decreasing a time of request by using rails cache mechanizm

In layouts we can see a default turbolinks javascripts and stylesheets tags.

<%= stylesheet_link_tag "application", media: "all",
                                                "data-turbolinks-track" => true %> 
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>

There is also one major change about params that is Strong parameters.so rails 4 introduces this which restricts parameters directly injected to a database. 
so each models will have a permit method to allow a params to be available to activerecord object. 

In my next blog i will update more things on rails

No comments:

Post a Comment