Shiva Kumar 's Blog

Start small,Think Big


Rails 4 new features

In this post will be explaining some new stuffs ,changes and deprecation in rails 4 Lets start with concerns.In Rails 3, as you can see comments and tags are nested routes for coupons and posts which has a quite of lot duplication in code resources :coupons do resources :comments resources :tags end resources :posts do [...]

, ,

Tagging with jquery tokeninput and ActsAsTaggableOn gem

Tagging  has become important part of most the application,so that we can easily filter out the post or content according to the category or  type. Today im gonna run you through how to build a tagging system.Which i recently implemented using jquery tokeninput and ActsAsTaggableOn gem .Tokeninput is jquery plugin which uses to select mulitple item from predefined list [...]

, , , , , , ,

Rails Application structure

A brief explanation of rails application structure .i.e what folders and files are  created by rails when type the rails new app_name command Assets - This is  where you have all your static files like image,stylesheets,javascript these are compiled by sprockets.when deployed these are served from /assets directory Controller -This is where all your controller goes which [...]

, , ,

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 [...]