Cleanup trailing whitespace

Trailing whitespace isn't friendly to git or vim users.
This commit is contained in:
Erik Michaels-Ober 2012-03-06 13:42:28 -08:00
parent 9db9a8e9a6
commit 1174647779
36 changed files with 104 additions and 104 deletions

View File

@ -16,4 +16,4 @@
* @widget.unique_impression_count now uses request_hash. This was incorrectly stated in the README, since it was using ip_address. The README is correct as a result of the method change. * @widget.unique_impression_count now uses request_hash. This was incorrectly stated in the README, since it was using ip_address. The README is correct as a result of the method change.
== 0.2.4 (2011-02-17) == 0.2.4 (2011-02-17)
* Fix issue #1 - action_name and controller_name were not being logged for impressionist method inside action * Fix issue #1 - action_name and controller_name were not being logged for impressionist method inside action

View File

@ -1 +1 @@
1.0.1 1.0.1

View File

@ -39,22 +39,22 @@ module ImpressionistController
end end
private private
def bypass def bypass
Impressionist::Bots::WILD_CARDS.each do |wild_card| Impressionist::Bots::WILD_CARDS.each do |wild_card|
return true if request.user_agent and request.user_agent.downcase.include? wild_card return true if request.user_agent and request.user_agent.downcase.include? wild_card
end end
Impressionist::Bots::LIST.include? request.user_agent Impressionist::Bots::LIST.include? request.user_agent
end end
def unique_instance?(impressionable, unique_opts) def unique_instance?(impressionable, unique_opts)
return unique_opts.blank? || !impressionable.impressions.where(unique_query(unique_opts)).exists? return unique_opts.blank? || !impressionable.impressions.where(unique_query(unique_opts)).exists?
end end
def unique?(unique_opts) def unique?(unique_opts)
return unique_opts.blank? || !Impression.where(unique_query(unique_opts)).exists? return unique_opts.blank? || !Impression.where(unique_query(unique_opts)).exists?
end end
# creates the query to check for uniqueness # creates the query to check for uniqueness
def unique_query(unique_opts) def unique_query(unique_opts)
full_statement = direct_create_statement full_statement = direct_create_statement
@ -64,7 +64,7 @@ module ImpressionistController
query query
end end
end end
# creates a statment hash that contains default values for creating an impression via an AR relation. # creates a statment hash that contains default values for creating an impression via an AR relation.
def associative_create_statement(query_params={}) def associative_create_statement(query_params={})
query_params.reverse_merge!( query_params.reverse_merge!(
@ -77,7 +77,7 @@ module ImpressionistController
:referrer => request.referer :referrer => request.referer
) )
end end
# creates a statment hash that contains default values for creating an impression. # creates a statment hash that contains default values for creating an impression.
def direct_create_statement(query_params={}) def direct_create_statement(query_params={})
query_params.reverse_merge!( query_params.reverse_merge!(
@ -86,7 +86,7 @@ module ImpressionistController
) )
associative_create_statement(query_params) associative_create_statement(query_params)
end end
def session_hash def session_hash
# # careful: request.session_options[:id] encoding in rspec test was ASCII-8BIT # # careful: request.session_options[:id] encoding in rspec test was ASCII-8BIT
# # that broke the database query for uniqueness. not sure if this is a testing only issue. # # that broke the database query for uniqueness. not sure if this is a testing only issue.
@ -95,7 +95,7 @@ module ImpressionistController
# # request.session_options[:id].encode("ISO-8859-1") # # request.session_options[:id].encode("ISO-8859-1")
request.session_options[:id] request.session_options[:id]
end end
#use both @current_user and current_user helper #use both @current_user and current_user helper
def user_id def user_id
user_id = @current_user ? @current_user.id : nil rescue nil user_id = @current_user ? @current_user.id : nil rescue nil
@ -103,4 +103,4 @@ module ImpressionistController
user_id user_id
end end
end end
end end

View File

@ -13,4 +13,4 @@ class Impression < ActiveRecord::Base
resouce.try(:update_counter_cache) resouce.try(:update_counter_cache)
end end
end end
end end

View File

@ -1,8 +1,8 @@
module Impressionist module Impressionist
module Bots module Bots
WILD_CARDS = ["bot","yahoo","slurp","google","msn","crawler"] WILD_CARDS = ["bot","yahoo","slurp","google","msn","crawler"]
LIST = ["<a href='http://www.unchaos.com/'> UnChaos </a> From Chaos To Order Hybrid Web Search Engine.(vadim_gonchar@unchaos.com)", LIST = ["<a href='http://www.unchaos.com/'> UnChaos </a> From Chaos To Order Hybrid Web Search Engine.(vadim_gonchar@unchaos.com)",
"<a href='http://www.unchaos.com/'> UnChaos Bot Hybrid Web Search Engine. </a> (vadim_gonchar@unchaos.com)", "<a href='http://www.unchaos.com/'> UnChaos Bot Hybrid Web Search Engine. </a> (vadim_gonchar@unchaos.com)",
"<b> UnChaosBot From Chaos To Order UnChaos Hybrid Web Search Engine at www.unchaos.com </b> (info@unchaos.com)", "<b> UnChaosBot From Chaos To Order UnChaos Hybrid Web Search Engine at www.unchaos.com </b> (info@unchaos.com)",
"<http://www.sygol.com/> http://www.sygol.com", "<http://www.sygol.com/> http://www.sygol.com",
@ -1459,4 +1459,4 @@ module Impressionist
"zspider/0.9-dev http://feedback.redkolibri.com/", "zspider/0.9-dev http://feedback.redkolibri.com/",
"ZyBorg/1.0 (ZyBorg@WISEnut.com; http://www.WISEnut.com)"] "ZyBorg/1.0 (ZyBorg@WISEnut.com; http://www.WISEnut.com)"]
end end
end end

View File

@ -1,2 +1,2 @@
Rails.application.routes.draw do Rails.application.routes.draw do
end end

View File

@ -1,5 +1,5 @@
require 'rails/generators' require 'rails/generators'
require 'rails/generators/migration' require 'rails/generators/migration'
class ImpressionistGenerator < Rails::Generators::Base class ImpressionistGenerator < Rails::Generators::Base
include Rails::Generators::Migration include Rails::Generators::Migration
@ -17,4 +17,4 @@ class ImpressionistGenerator < Rails::Generators::Base
def create_migration_file def create_migration_file
migration_template 'create_impressions_table.rb', 'db/migrate/create_impressions_table.rb' migration_template 'create_impressions_table.rb', 'db/migrate/create_impressions_table.rb'
end end
end end

View File

@ -34,4 +34,4 @@ class CreateImpressionsTable < ActiveRecord::Migration
drop_table :impressions drop_table :impressions
end end
end end

View File

@ -15,4 +15,4 @@ module Impressionist
list list
end end
end end
end end

View File

@ -14,4 +14,4 @@ module Impressionist
end end
end end
end end
end end

View File

@ -1,7 +1,7 @@
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
protect_from_forgery protect_from_forgery
before_filter :secondary_before_filter before_filter :secondary_before_filter
def secondary_before_filter def secondary_before_filter
@test_secondary_before_filter = "this is a test" @test_secondary_before_filter = "this is a test"
end end

View File

@ -1,18 +1,18 @@
class ArticlesController < ApplicationController class ArticlesController < ApplicationController
before_filter :test_current_user_var before_filter :test_current_user_var
def test_current_user_var def test_current_user_var
if session[:user_id] if session[:user_id]
@current_user = User.new @current_user = User.new
@current_user.id = session[:user_id] @current_user.id = session[:user_id]
end end
end end
def index def index
impressionist(Article.first,"this is a test article impression") impressionist(Article.first,"this is a test article impression")
end end
def show def show
impressionist(Article.first) impressionist(Article.first)
end end
end end

View File

@ -2,17 +2,17 @@ class PostsController < ApplicationController
helper_method :current_user helper_method :current_user
impressionist impressionist
def index def index
end end
def show def show
end end
def edit def edit
end end
def current_user def current_user
if session[:user_id] if session[:user_id]
user = User.new user = User.new
@ -20,4 +20,4 @@ class PostsController < ApplicationController
@current_user ||= user @current_user ||= user
end end
end end
end end

View File

@ -1,13 +1,13 @@
class WidgetsController < ApplicationController class WidgetsController < ApplicationController
impressionist :actions=>[:show,:index], :unique => [:controller_name,:action_name,:impressionable_id] impressionist :actions=>[:show,:index], :unique => [:controller_name,:action_name,:impressionable_id]
def show def show
end end
def index def index
end end
def new def new
end end
end end

View File

@ -4,4 +4,4 @@
class Dummy < ActiveRecord::Base class Dummy < ActiveRecord::Base
self.abstract_class = true # doesn't need to be backed by an actual table self.abstract_class = true # doesn't need to be backed by an actual table
is_impressionable is_impressionable
end end

View File

@ -1,3 +1,3 @@
class User class User
attr_accessor :id attr_accessor :id
end end

View File

@ -1 +1 @@
<%=@impressionist_hash==nil%> <%=@impressionist_hash==nil%>

View File

@ -1 +1 @@
<%=link_to "Same Page", article_url(Article.first)%> <%=link_to "Same Page", article_url(Article.first)%>

View File

@ -16,7 +16,7 @@ test: &test
# adapter: postgresql # adapter: postgresql
# database: impressionist_test # database: impressionist_test
# username: johnmcaliley # username: johnmcaliley
# password: # password:
# host: localhost # host: localhost
# encoding: UTF8 # encoding: UTF8
@ -27,4 +27,4 @@ production:
timeout: 5000 timeout: 5000
cucumber: cucumber:
<<: *test <<: *test

View File

@ -16,22 +16,22 @@ class CreateImpressionsTable < ActiveRecord::Migration
end end
add_index :impressions, [:impressionable_type, :impressionable_id, :request_hash], :name => "poly_request_index", :unique => false 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, :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, [: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,: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, :user_id add_index :impressions, :user_id
end end
def self.down def self.down
remove_index :impressions, :name => :poly_request_index remove_index :impressions, :name => :poly_request_index
remove_index :impressions, :name => :poly_ip_index remove_index :impressions, :name => :poly_ip_index
remove_index :impressions, :name => :poly_session_index remove_index :impressions, :name => :poly_session_index
remove_index :impressions, :name => :controlleraction_request_index remove_index :impressions, :name => :controlleraction_request_index
remove_index :impressions, :name => :controlleraction_ip_index remove_index :impressions, :name => :controlleraction_ip_index
remove_index :impressions, :name => :controlleraction_session_index remove_index :impressions, :name => :controlleraction_session_index
remove_index :impressions, :user_id remove_index :impressions, :user_id
drop_table :impressions drop_table :impressions
end end
end end

View File

@ -1,6 +1,6 @@
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a # It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file # newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb # instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files. # files.

View File

@ -962,4 +962,4 @@ Form.Element.DelayedObserver = Class.create({
this.timer = null; this.timer = null;
this.callback(this.element, $F(this.element)); this.callback(this.element, $F(this.element));
} }
}); });

View File

@ -971,4 +971,4 @@ Element.findChildren = function(element, only, recursive, tagName) {
Element.offsetSize = function (element, type) { Element.offsetSize = function (element, type) {
return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')]; return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
}; };

View File

@ -1120,4 +1120,4 @@ $w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTex
function(f) { Effect.Methods[f] = Element[f]; } function(f) { Effect.Methods[f] = Element[f]; }
); );
Element.addMethods(Effect.Methods); Element.addMethods(Effect.Methods);

View File

@ -95,9 +95,9 @@ describe WidgetsController do
get "show", :id=> 1 get "show", :id=> 1
Impression.all.size.should eq 11 Impression.all.size.should eq 11
end end
describe "impressionist unique options" do describe "impressionist unique options" do
it "should log unique impressions at the per action level" do it "should log unique impressions at the per action level" do
get "show", :id=> 1 get "show", :id=> 1
Impression.all.size.should eq 12 Impression.all.size.should eq 12
@ -108,7 +108,7 @@ describe WidgetsController do
get "index" get "index"
Impression.all.size.should eq 14 Impression.all.size.should eq 14
end end
it "should log unique impressions only once per id" do it "should log unique impressions only once per id" do
get "show", :id=> 1 get "show", :id=> 1
Impression.all.size.should eq 12 Impression.all.size.should eq 12
@ -119,7 +119,7 @@ describe WidgetsController do
get "index" get "index"
Impression.all.size.should eq 14 Impression.all.size.should eq 14
end end
end end
end end

View File

@ -1,3 +1,3 @@
one: one:
id: 1 id: 1
name: Test Article name: Test Article

View File

@ -16,7 +16,7 @@ impression8:
session_hash: b1 session_hash: b1
ip_address: 127.0.0.1 ip_address: 127.0.0.1
created_at: 2010-01-01 created_at: 2010-01-01
impression9: impression9:
impressionable_type: Article impressionable_type: Article
impressionable_id: 1 impressionable_id: 1
@ -24,20 +24,20 @@ impression9:
session_hash: b2 session_hash: b2
ip_address: 127.0.0.1 ip_address: 127.0.0.1
created_at: 2011-01-03 created_at: 2011-01-03
impression10: impression10:
impressionable_type: Article impressionable_type: Article
impressionable_id: 1 impressionable_id: 1
request_hash: a9 request_hash: a9
session_hash: b3 session_hash: b3
ip_address: 127.0.0.8 ip_address: 127.0.0.8
created_at: 2010-01-01 created_at: 2010-01-01
impression11: impression11:
impressionable_type: Article impressionable_type: Article
impressionable_id: 1 impressionable_id: 1
request_hash: a10 request_hash: a10
session_hash: b4 session_hash: b4
ip_address: 127.0.0.1 ip_address: 127.0.0.1
created_at: 2010-01-01 created_at: 2010-01-01

View File

@ -1,3 +1,3 @@
one: one:
id: 1 id: 1
name: Test Post name: Test Post

View File

@ -1,4 +1,4 @@
one: one:
id: 1 id: 1
name: A Widget name: A Widget
impressions_count: 0 impressions_count: 0

View File

@ -5,14 +5,14 @@ describe Impressionist do
method = RUBY_VERSION.match("1.8") ? "is_impressionable" : :is_impressionable method = RUBY_VERSION.match("1.8") ? "is_impressionable" : :is_impressionable
ActiveRecord::Base.methods.include?(method).should be true ActiveRecord::Base.methods.include?(method).should be true
end end
it "should include methods in ApplicationController" do it "should include methods in ApplicationController" do
method = RUBY_VERSION.match("1.8") ? "impressionist" : :impressionist method = RUBY_VERSION.match("1.8") ? "impressionist" : :impressionist
ApplicationController.instance_methods.include?(method).should be true ApplicationController.instance_methods.include?(method).should be true
end end
it "should include the before_filter method in ApplicationController" do it "should include the before_filter method in ApplicationController" do
filters = ApplicationController._process_action_callbacks.select { |c| c.kind == :before } filters = ApplicationController._process_action_callbacks.select { |c| c.kind == :before }
filters.collect{|filter|filter.filter}.include?(:impressionist_app_filter).should be true filters.collect{|filter|filter.filter}.include?(:impressionist_app_filter).should be true
end end
end end

View File

@ -27,4 +27,4 @@ describe Impression do
end end
end end
end end

View File

@ -2,33 +2,33 @@ require 'spec_helper'
describe Impression do describe Impression do
fixtures :articles,:impressions,:posts fixtures :articles,:impressions,:posts
before(:each) do before(:each) do
@article = Article.find(1) @article = Article.find(1)
end end
it "should save a blank impression for an Article that has 10 impressions" do it "should save a blank impression for an Article that has 10 impressions" do
@article.impressions.create @article.impressions.create
@article.impressions.size.should eq 12 @article.impressions.size.should eq 12
end end
it "should save an impression with a message" do it "should save an impression with a message" do
@article.impressions.create(:message=>"test message") @article.impressions.create(:message=>"test message")
@article.impressions.last.message.should eq "test message" @article.impressions.last.message.should eq "test message"
end end
it "should return the impression count for all with no date range specified" do it "should return the impression count for all with no date range specified" do
@article.impressionist_count(:filter=>:all).should eq 11 @article.impressionist_count(:filter=>:all).should eq 11
end end
it "should return unique impression count with no date range specified" do it "should return unique impression count with no date range specified" do
@article.impressionist_count.should eq 9 @article.impressionist_count.should eq 9
end end
it "should return impression count with only start date specified" do it "should return impression count with only start date specified" do
@article.impressionist_count(:start_date=>"2011-01-01",:filter=>:all).should eq 8 @article.impressionist_count(:start_date=>"2011-01-01",:filter=>:all).should eq 8
end end
it "should return impression count with whole date range specified" do it "should return impression count with whole date range specified" do
@article.impressionist_count(:start_date=>"2011-01-01",:end_date=>"2011-01-02",:filter=>:all).should eq 7 @article.impressionist_count(:start_date=>"2011-01-01",:end_date=>"2011-01-02",:filter=>:all).should eq 7
end end
@ -36,11 +36,11 @@ describe Impression do
it "should return unique impression count with only start date specified" do it "should return unique impression count with only start date specified" do
@article.impressionist_count(:start_date=>"2011-01-01").should eq 7 @article.impressionist_count(:start_date=>"2011-01-01").should eq 7
end end
it "should return unique impression count with date range specified" do it "should return unique impression count with date range specified" do
@article.impressionist_count(:start_date=>"2011-01-01",:end_date=>"2011-01-02").should eq 7 @article.impressionist_count(:start_date=>"2011-01-01",:end_date=>"2011-01-02").should eq 7
end end
it "should return unique impression count using ip address (which in turn eliminates duplicate request_hashes)" do it "should return unique impression count using ip address (which in turn eliminates duplicate request_hashes)" do
@article.impressionist_count(:filter=>:ip_address).should eq 8 @article.impressionist_count(:filter=>:ip_address).should eq 8
end end
@ -48,7 +48,7 @@ describe Impression do
it "should return unique impression count using session_hash (which in turn eliminates duplicate request_hashes)" do it "should return unique impression count using session_hash (which in turn eliminates duplicate request_hashes)" do
@article.impressionist_count(:filter=>:session_hash).should eq 7 @article.impressionist_count(:filter=>:session_hash).should eq 7
end end
# tests :dependent => :destroy # tests :dependent => :destroy
it "should delete impressions on deletion of impressionable" do it "should delete impressions on deletion of impressionable" do
impressions_count = Impression.all.size impressions_count = Impression.all.size
@ -58,20 +58,20 @@ describe Impression do
a.destroyed?.should be_true a.destroyed?.should be_true
i.destroyed?.should be_true i.destroyed?.should be_true
end end
#OLD COUNT METHODS. DEPRECATE SOON #OLD COUNT METHODS. DEPRECATE SOON
it "should return the impression count with no date range specified" do it "should return the impression count with no date range specified" do
@article.impression_count.should eq 11 @article.impression_count.should eq 11
end end
it "should return unique impression count with no date range specified" do it "should return unique impression count with no date range specified" do
@article.unique_impression_count.should eq 9 @article.unique_impression_count.should eq 9
end end
it "should return impression count with only start date specified" do it "should return impression count with only start date specified" do
@article.impression_count("2011-01-01").should eq 8 @article.impression_count("2011-01-01").should eq 8
end end
it "should return impression count with whole date range specified" do it "should return impression count with whole date range specified" do
@article.impression_count("2011-01-01","2011-01-02").should eq 7 @article.impression_count("2011-01-01","2011-01-02").should eq 7
end end
@ -79,11 +79,11 @@ describe Impression do
it "should return unique impression count with only start date specified" do it "should return unique impression count with only start date specified" do
@article.unique_impression_count("2011-01-01").should eq 7 @article.unique_impression_count("2011-01-01").should eq 7
end end
it "should return unique impression count with date range specified" do it "should return unique impression count with date range specified" do
@article.unique_impression_count("2011-01-01","2011-01-02").should eq 7 @article.unique_impression_count("2011-01-01","2011-01-02").should eq 7
end end
it "should return unique impression count using ip address (which in turn eliminates duplicate request_hashes)" do it "should return unique impression count using ip address (which in turn eliminates duplicate request_hashes)" do
@article.unique_impression_count_ip.should eq 8 @article.unique_impression_count_ip.should eq 8
end end
@ -91,4 +91,4 @@ describe Impression do
it "should return unique impression count using session_hash (which in turn eliminates duplicate request_hashes)" do it "should return unique impression count using session_hash (which in turn eliminates duplicate request_hashes)" do
@article.unique_impression_count_session.should eq 7 @article.unique_impression_count_session.should eq 7
end end
end end

View File

@ -13,9 +13,9 @@ describe Impressionist do
migration_name = generator_output.split("migrate/")[1].strip migration_name = generator_output.split("migrate/")[1].strip
Dir.entries(migrations_dir).include?(migration_name).should be true Dir.entries(migrations_dir).include?(migration_name).should be true
end end
it "should run the migration created in the previous spec" do it "should run the migration created in the previous spec" do
migrate_output = systemu("rake db:migrate RAILS_ENV=test") migrate_output = systemu("rake db:migrate RAILS_ENV=test")
migrate_output[1].include?("CreateImpressionsTable: migrated").should be true migrate_output[1].include?("CreateImpressionsTable: migrated").should be true
end end
end end

View File

@ -24,10 +24,10 @@ RSpec.configure do |config|
# examples within a transaction, remove the following line or assign false # examples within a transaction, remove the following line or assign false
# instead of true. # instead of true.
config.use_transactional_fixtures = true config.use_transactional_fixtures = true
# make the rails logger usable in the tests as logger.xxx "..." # make the rails logger usable in the tests as logger.xxx "..."
def logger def logger
Rails.logger Rails.logger
end end
end end

View File

@ -5,23 +5,23 @@ class CreateImpressionsTable < ActiveRecord::Migration
remove_index :impressions, :name => :controlleraction_index remove_index :impressions, :name => :controlleraction_index
add_index :impressions, [:impressionable_type, :impressionable_id, :request_hash], :name => "poly_request_index", :unique => false 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, :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, [: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,: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
end end
def self.down def self.down
remove_column :impressions, :session_hash remove_column :impressions, :session_hash
remove_index :impressions, :name => :poly_request_index remove_index :impressions, :name => :poly_request_index
remove_index :impressions, :name => :poly_ip_index remove_index :impressions, :name => :poly_ip_index
remove_index :impressions, :name => :poly_session_index remove_index :impressions, :name => :poly_session_index
remove_index :impressions, :name => :controlleraction_request_index remove_index :impressions, :name => :controlleraction_request_index
remove_index :impressions, :name => :controlleraction_ip_index remove_index :impressions, :name => :controlleraction_ip_index
remove_index :impressions, :name => :controlleraction_session_index remove_index :impressions, :name => :controlleraction_session_index
remove_index :impressions, :user_id remove_index :impressions, :user_id
add_index :impressions, [:impressionable_type, :impressionable_id, :request_hash, :ip_address], :name => "poly_index", :unique => false add_index :impressions, [:impressionable_type, :impressionable_id, :request_hash, :ip_address], :name => "poly_index", :unique => false
add_index :impressions, [:controller_name,:action_name,:request_hash,:ip_address], :name => "controlleraction_index", :unique => false add_index :impressions, [:controller_name,:action_name,:request_hash,:ip_address], :name => "controlleraction_index", :unique => false
end end
end end

View File

@ -1,9 +1,9 @@
class Version04UpdateImpressionsTable < ActiveRecord::Migration class Version04UpdateImpressionsTable < ActiveRecord::Migration
def self.up def self.up
add_column :impressions, :referrer, :string add_column :impressions, :referrer, :string
end end
def self.down def self.down
remove_column :impressions, :referrer remove_column :impressions, :referrer
end end
end end