Shiva Kumar 's Blog

Start small,Think Big

June, 2012

Rails Routes Part 1 explained ..

Rails routes ,in simple word it connect incoming request from the browser to controller to perform particular action  .Routes file is in your app/config/routes.rb When a rails application get Url request like this get /user/17 match “users/:id” => “users#show” which means it ask the router to look for users controller and show action where user […]

, ,

Counter_cache => true (improves performance )

Counter cache is a simple feature that keeps the count of child object in parent table .So that you dont have to perform a query to find the size of the object each time  .Rails automatically updates the counter when there is association made between the parent and child .Adding counter_cache to new table is […]