Updated readme.
This commit is contained in:
parent
85a714ff21
commit
1a8d6c5a94
14
README.md
14
README.md
|
@ -125,18 +125,18 @@ What if I only want to record unique impressions?
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
Maybe you only care about unique impressions and would like to eliminate unnecessary database calls. You can specify conditions for recording impressions in your controller:
|
Maybe you only care about unique impressions and would like to eliminate unnecessary database calls. You can specify conditions for recording impressions in your controller:
|
||||||
|
|
||||||
# only record impression if the request has a unique combination of type, id, and session
|
# only record impression if the request has a unique combination of type, id, and session
|
||||||
impressionist :unique => [:impressionable_type, :impressionable_id, :session_hash]
|
impressionist :unique => [:impressionable_type, :impressionable_id, :session_hash]
|
||||||
|
|
||||||
# only record impression if the request has a unique combination of controller, action, and session
|
# only record impression if the request has a unique combination of controller, action, and session
|
||||||
impressionist :unique => [:controller_name, :action_name, :session_hash]
|
impressionist :unique => [:controller_name, :action_name, :session_hash]
|
||||||
|
|
||||||
# only record impression if session is unique
|
# only record impression if session is unique
|
||||||
impressionist :unique => [:session_hash]
|
impressionist :unique => [:session_hash]
|
||||||
|
|
||||||
Or you can use the `impressionist` method directly:
|
Or you can use the `impressionist` method directly:
|
||||||
|
|
||||||
impressionist(impressionable, "some message", :unique => [:session_hash])
|
impressionist(impressionable, "some message", :unique => [:session_hash])
|
||||||
|
|
||||||
|
|
||||||
Development Roadmap
|
Development Roadmap
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
PATH
|
PATH
|
||||||
remote: /Users/coryschires/Desktop/impressionist
|
remote: /Users/coryschires/Desktop/work/applications/impressionist
|
||||||
specs:
|
specs:
|
||||||
impressionist (0.4.0)
|
impressionist (0.4.0)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
class CreateImpressionsTable < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
create_table :impressions, :force => true do |t|
|
||||||
|
t.string :impressionable_type
|
||||||
|
t.integer :impressionable_id
|
||||||
|
t.integer :user_id
|
||||||
|
t.string :controller_name
|
||||||
|
t.string :action_name
|
||||||
|
t.string :view_name
|
||||||
|
t.string :request_hash
|
||||||
|
t.string :session_hash
|
||||||
|
t.string :ip_address
|
||||||
|
t.string :message
|
||||||
|
t.string :referrer
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :impressions, [:impressionable_type, :impressionable_id, :request_hash], :name => "poly_request_index", :unique => false
|
||||||
|
add_index :impressions, [:impressionable_type, :impressionable_id, :ip_address], :name => "poly_ip_index", :unique => false
|
||||||
|
add_index :impressions, [:impressionable_type, :impressionable_id, :session_hash], :name => "poly_session_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,:session_hash], :name => "controlleraction_session_index", :unique => false
|
||||||
|
add_index :impressions, :user_id
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
remove_index :impressions, :name => :poly_request_index
|
||||||
|
remove_index :impressions, :name => :poly_ip_index
|
||||||
|
remove_index :impressions, :name => :poly_session_index
|
||||||
|
remove_index :impressions, :name => :controlleraction_request_index
|
||||||
|
remove_index :impressions, :name => :controlleraction_ip_index
|
||||||
|
remove_index :impressions, :name => :controlleraction_session_index
|
||||||
|
remove_index :impressions, :user_id
|
||||||
|
|
||||||
|
drop_table :impressions
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue