Adding params field to migration file.

This commit is contained in:
asharma-ror 2015-04-22 10:31:22 +05:30
parent 9d997bc600
commit 8c3407fd33
4 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,2 @@
class Impression class Impression
attr_accessible :params
store :params
end end

View File

@ -12,6 +12,7 @@ class CreateImpressionsTable < ActiveRecord::Migration
t.string :session_hash t.string :session_hash
t.text :message t.text :message
t.text :referrer t.text :referrer
t.text :params
t.timestamps t.timestamps
end end
add_index :impressions, [:impressionable_type, :message, :impressionable_id], :name => "impressionable_type_message_index", :unique => false, :length => {:message => 255 } add_index :impressions, [:impressionable_type, :message, :impressionable_id], :name => "impressionable_type_message_index", :unique => false, :length => {:message => 255 }
@ -21,6 +22,7 @@ class CreateImpressionsTable < ActiveRecord::Migration
add_index :impressions, [:controller_name,:action_name,:request_hash], :name => "controlleraction_request_index", :unique => false add_index :impressions, [:controller_name,:action_name,:request_hash], :name => "controlleraction_request_index", :unique => false
add_index :impressions, [:controller_name,:action_name,:ip_address], :name => "controlleraction_ip_index", :unique => false add_index :impressions, [:controller_name,:action_name,:ip_address], :name => "controlleraction_ip_index", :unique => false
add_index :impressions, [:controller_name,:action_name,:session_hash], :name => "controlleraction_session_index", :unique => false add_index :impressions, [:controller_name,:action_name,:session_hash], :name => "controlleraction_session_index", :unique => false
add_index :impressions, [:impressionable_type, :impressionable_id, :params], :name => "poly_params_request_index", :unique => false
add_index :impressions, :user_id add_index :impressions, :user_id
end end

View File

@ -9,6 +9,6 @@ class Impression < ActiveRecord::Base
# sets belongs_to and attr_accessible depending on Rails version # sets belongs_to and attr_accessible depending on Rails version
Impressionist::SetupAssociation.new(self).set Impressionist::SetupAssociation.new(self).set
store :params
after_save :impressionable_counter_cache_updatable? after_save :impressionable_counter_cache_updatable?
end end

View File

@ -35,7 +35,8 @@ module Impressionist
:view_name, :view_name,
:referrer, :referrer,
:message, :message,
:user_id) :user_id,
:params)
end end
def toggle def toggle