Talk:Workbook
From mi-linux
Jump to navigationJump to searchcounting 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