From d7d328a6da336b590f9056981a1511b970f6c833 Mon Sep 17 00:00:00 2001 From: Antonio C Nalesso Moreira Date: Fri, 5 Jul 2013 04:28:09 +0100 Subject: [PATCH] Update README.md Explain how to add column to a model. --- README.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 684ff2d..70a4ef7 100644 --- a/README.md +++ b/README.md @@ -136,14 +136,21 @@ most basic configuration looks like: is_impressionable :counter_cache => true This will automatically increment the `impressions_count` column in the -included model. Note: You'll need to add that column to your model. If you'd -like specific a different column name, you can: +included model. Note: You'll need to add that column to your model. If you'd +like specific a different column name, you can: - is_impressionable :counter_cache => { :column_name => :my_column } + is_impressionable :counter_cache => { :column_name => :my_column_name } If you'd like to include only unique impressions in your count: - is_impressionable :counter_cache => { :column_name => :my_column, :unique => true } + is_impressionable :counter_cache => { :column_name => :my_column_name, :unique => true } + + +Adding column to model +---------------------- +It is as simple as this: + + t.integer :my_column_name, :default => 0 What if I only want to record unique impressions? -------------------------------------------------