Talk:Workbook

From mi-linux
Revision as of 19:36, 7 April 2008 by 0517434 (talk | contribs) (counting User Profile views)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

counting User Profile views

set up a table for the view count as follows:

1


create_table :user_views do |t| t.column :user_profile_id, :integer t.column :count, :integer, :default => 1 t.column :created_at, :datetime end

2- create controller called User,


Class UserController < ApplicationController def view unless @user == current_user session[:visited_profiles] << user_profile.id unless session[:visited_profiles].include?(user_profile.id)

end 
  end 

end