diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc
index 80506ca..c3378b2 100644
--- a/CHANGELOG.rdoc
+++ b/CHANGELOG.rdoc
@@ -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.
== 0.2.4 (2011-02-17)
-* Fix issue #1 - action_name and controller_name were not being logged for impressionist method inside action
\ No newline at end of file
+* Fix issue #1 - action_name and controller_name were not being logged for impressionist method inside action
diff --git a/VERSION b/VERSION
index 7f20734..7dea76e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0.1
\ No newline at end of file
+1.0.1
diff --git a/app/controllers/impressionist_controller.rb b/app/controllers/impressionist_controller.rb
index 15a87df..6f6e774 100644
--- a/app/controllers/impressionist_controller.rb
+++ b/app/controllers/impressionist_controller.rb
@@ -39,22 +39,22 @@ module ImpressionistController
end
private
-
+
def bypass
Impressionist::Bots::WILD_CARDS.each do |wild_card|
return true if request.user_agent and request.user_agent.downcase.include? wild_card
end
Impressionist::Bots::LIST.include? request.user_agent
end
-
+
def unique_instance?(impressionable, unique_opts)
return unique_opts.blank? || !impressionable.impressions.where(unique_query(unique_opts)).exists?
end
-
+
def unique?(unique_opts)
return unique_opts.blank? || !Impression.where(unique_query(unique_opts)).exists?
end
-
+
# creates the query to check for uniqueness
def unique_query(unique_opts)
full_statement = direct_create_statement
@@ -64,7 +64,7 @@ module ImpressionistController
query
end
end
-
+
# creates a statment hash that contains default values for creating an impression via an AR relation.
def associative_create_statement(query_params={})
query_params.reverse_merge!(
@@ -77,7 +77,7 @@ module ImpressionistController
:referrer => request.referer
)
end
-
+
# creates a statment hash that contains default values for creating an impression.
def direct_create_statement(query_params={})
query_params.reverse_merge!(
@@ -86,7 +86,7 @@ module ImpressionistController
)
associative_create_statement(query_params)
end
-
+
def session_hash
# # 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.
@@ -95,7 +95,7 @@ module ImpressionistController
# # request.session_options[:id].encode("ISO-8859-1")
request.session_options[:id]
end
-
+
#use both @current_user and current_user helper
def user_id
user_id = @current_user ? @current_user.id : nil rescue nil
@@ -103,4 +103,4 @@ module ImpressionistController
user_id
end
end
-end
\ No newline at end of file
+end
diff --git a/app/models/impression.rb b/app/models/impression.rb
index 8b01ce9..98c3b33 100644
--- a/app/models/impression.rb
+++ b/app/models/impression.rb
@@ -13,4 +13,4 @@ class Impression < ActiveRecord::Base
resouce.try(:update_counter_cache)
end
end
-end
\ No newline at end of file
+end
diff --git a/app/models/impressionist/bots.rb b/app/models/impressionist/bots.rb
index 21f2012..d0343e9 100644
--- a/app/models/impressionist/bots.rb
+++ b/app/models/impressionist/bots.rb
@@ -1,8 +1,8 @@
module Impressionist
module Bots
WILD_CARDS = ["bot","yahoo","slurp","google","msn","crawler"]
-
- LIST = [" UnChaos From Chaos To Order Hybrid Web Search Engine.(vadim_gonchar@unchaos.com)",
+
+ LIST = [" UnChaos From Chaos To Order Hybrid Web Search Engine.(vadim_gonchar@unchaos.com)",
" UnChaos Bot Hybrid Web Search Engine. (vadim_gonchar@unchaos.com)",
" UnChaosBot From Chaos To Order UnChaos Hybrid Web Search Engine at www.unchaos.com (info@unchaos.com)",
" http://www.sygol.com",
@@ -1459,4 +1459,4 @@ module Impressionist
"zspider/0.9-dev http://feedback.redkolibri.com/",
"ZyBorg/1.0 (ZyBorg@WISEnut.com; http://www.WISEnut.com)"]
end
-end
\ No newline at end of file
+end
diff --git a/config/routes.rb b/config/routes.rb
index c9a9983..1daf9a4 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,2 +1,2 @@
Rails.application.routes.draw do
-end
\ No newline at end of file
+end
diff --git a/lib/generators/impressionist/impressionist_generator.rb b/lib/generators/impressionist/impressionist_generator.rb
index 98273f0..156f1a9 100644
--- a/lib/generators/impressionist/impressionist_generator.rb
+++ b/lib/generators/impressionist/impressionist_generator.rb
@@ -1,5 +1,5 @@
require 'rails/generators'
-require 'rails/generators/migration'
+require 'rails/generators/migration'
class ImpressionistGenerator < Rails::Generators::Base
include Rails::Generators::Migration
@@ -17,4 +17,4 @@ class ImpressionistGenerator < Rails::Generators::Base
def create_migration_file
migration_template 'create_impressions_table.rb', 'db/migrate/create_impressions_table.rb'
end
-end
\ No newline at end of file
+end
diff --git a/lib/generators/impressionist/templates/create_impressions_table.rb b/lib/generators/impressionist/templates/create_impressions_table.rb
index 8c2fc69..72de511 100644
--- a/lib/generators/impressionist/templates/create_impressions_table.rb
+++ b/lib/generators/impressionist/templates/create_impressions_table.rb
@@ -34,4 +34,4 @@ class CreateImpressionsTable < ActiveRecord::Migration
drop_table :impressions
end
-end
\ No newline at end of file
+end
diff --git a/lib/impressionist/bots.rb b/lib/impressionist/bots.rb
index 1fbfb5d..10d3fd6 100644
--- a/lib/impressionist/bots.rb
+++ b/lib/impressionist/bots.rb
@@ -15,4 +15,4 @@ module Impressionist
list
end
end
-end
\ No newline at end of file
+end
diff --git a/lib/impressionist/engine.rb b/lib/impressionist/engine.rb
index 295fcf2..a4ecfb0 100644
--- a/lib/impressionist/engine.rb
+++ b/lib/impressionist/engine.rb
@@ -14,4 +14,4 @@ module Impressionist
end
end
end
-end
\ No newline at end of file
+end
diff --git a/test_app/app/controllers/application_controller.rb b/test_app/app/controllers/application_controller.rb
index ebefa26..1ce61fa 100644
--- a/test_app/app/controllers/application_controller.rb
+++ b/test_app/app/controllers/application_controller.rb
@@ -1,7 +1,7 @@
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :secondary_before_filter
-
+
def secondary_before_filter
@test_secondary_before_filter = "this is a test"
end
diff --git a/test_app/app/controllers/articles_controller.rb b/test_app/app/controllers/articles_controller.rb
index d154f1d..367b460 100644
--- a/test_app/app/controllers/articles_controller.rb
+++ b/test_app/app/controllers/articles_controller.rb
@@ -1,18 +1,18 @@
class ArticlesController < ApplicationController
before_filter :test_current_user_var
-
+
def test_current_user_var
if session[:user_id]
@current_user = User.new
@current_user.id = session[:user_id]
end
end
-
+
def index
impressionist(Article.first,"this is a test article impression")
end
-
+
def show
impressionist(Article.first)
end
-end
\ No newline at end of file
+end
diff --git a/test_app/app/controllers/posts_controller.rb b/test_app/app/controllers/posts_controller.rb
index 9acf731..3526270 100644
--- a/test_app/app/controllers/posts_controller.rb
+++ b/test_app/app/controllers/posts_controller.rb
@@ -2,17 +2,17 @@ class PostsController < ApplicationController
helper_method :current_user
impressionist
def index
-
+
end
-
+
def show
-
+
end
-
+
def edit
-
+
end
-
+
def current_user
if session[:user_id]
user = User.new
@@ -20,4 +20,4 @@ class PostsController < ApplicationController
@current_user ||= user
end
end
-end
\ No newline at end of file
+end
diff --git a/test_app/app/controllers/widgets_controller.rb b/test_app/app/controllers/widgets_controller.rb
index 3a7c5dd..433153c 100644
--- a/test_app/app/controllers/widgets_controller.rb
+++ b/test_app/app/controllers/widgets_controller.rb
@@ -1,13 +1,13 @@
class WidgetsController < ApplicationController
impressionist :actions=>[:show,:index], :unique => [:controller_name,:action_name,:impressionable_id]
-
+
def show
end
-
+
def index
end
-
+
def new
end
-
-end
\ No newline at end of file
+
+end
diff --git a/test_app/app/models/dummy.rb b/test_app/app/models/dummy.rb
index ebce846..745c60a 100644
--- a/test_app/app/models/dummy.rb
+++ b/test_app/app/models/dummy.rb
@@ -4,4 +4,4 @@
class Dummy < ActiveRecord::Base
self.abstract_class = true # doesn't need to be backed by an actual table
is_impressionable
-end
\ No newline at end of file
+end
diff --git a/test_app/app/models/user.rb b/test_app/app/models/user.rb
index 6738fc6..6da0f65 100644
--- a/test_app/app/models/user.rb
+++ b/test_app/app/models/user.rb
@@ -1,3 +1,3 @@
class User
attr_accessor :id
-end
\ No newline at end of file
+end
diff --git a/test_app/app/views/articles/index.html.erb b/test_app/app/views/articles/index.html.erb
index 0317923..97e10f8 100644
--- a/test_app/app/views/articles/index.html.erb
+++ b/test_app/app/views/articles/index.html.erb
@@ -1 +1 @@
-<%=@impressionist_hash==nil%>
\ No newline at end of file
+<%=@impressionist_hash==nil%>
diff --git a/test_app/app/views/articles/show.html.erb b/test_app/app/views/articles/show.html.erb
index 1826f15..7dc920f 100644
--- a/test_app/app/views/articles/show.html.erb
+++ b/test_app/app/views/articles/show.html.erb
@@ -1 +1 @@
-<%=link_to "Same Page", article_url(Article.first)%>
\ No newline at end of file
+<%=link_to "Same Page", article_url(Article.first)%>
diff --git a/test_app/config/database.yml b/test_app/config/database.yml
index 077168a..45fed06 100644
--- a/test_app/config/database.yml
+++ b/test_app/config/database.yml
@@ -16,7 +16,7 @@ test: &test
# adapter: postgresql
# database: impressionist_test
# username: johnmcaliley
-# password:
+# password:
# host: localhost
# encoding: UTF8
@@ -27,4 +27,4 @@ production:
timeout: 5000
cucumber:
- <<: *test
\ No newline at end of file
+ <<: *test
diff --git a/test_app/db/migrate/20111127195013_create_impressions_table.rb b/test_app/db/migrate/20111127195013_create_impressions_table.rb
index 22b6a90..8a83395 100644
--- a/test_app/db/migrate/20111127195013_create_impressions_table.rb
+++ b/test_app/db/migrate/20111127195013_create_impressions_table.rb
@@ -16,22 +16,22 @@ class CreateImpressionsTable < ActiveRecord::Migration
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, [: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, [: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 => :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, :name => :controlleraction_session_index
remove_index :impressions, :user_id
-
+
drop_table :impressions
end
-end
\ No newline at end of file
+end
diff --git a/test_app/lib/tasks/cucumber.rake b/test_app/lib/tasks/cucumber.rake
index 7db1a55..982054e 100644
--- a/test_app/lib/tasks/cucumber.rake
+++ b/test_app/lib/tasks/cucumber.rake
@@ -1,6 +1,6 @@
# 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
-# newer version of cucumber-rails. Consider adding your own code to a new file
+# 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
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
diff --git a/test_app/public/javascripts/controls.js b/test_app/public/javascripts/controls.js
index 7392fb6..75d1bed 100644
--- a/test_app/public/javascripts/controls.js
+++ b/test_app/public/javascripts/controls.js
@@ -962,4 +962,4 @@ Form.Element.DelayedObserver = Class.create({
this.timer = null;
this.callback(this.element, $F(this.element));
}
-});
\ No newline at end of file
+});
diff --git a/test_app/public/javascripts/dragdrop.js b/test_app/public/javascripts/dragdrop.js
index 15c6dbc..579715e 100644
--- a/test_app/public/javascripts/dragdrop.js
+++ b/test_app/public/javascripts/dragdrop.js
@@ -971,4 +971,4 @@ Element.findChildren = function(element, only, recursive, tagName) {
Element.offsetSize = function (element, type) {
return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
-};
\ No newline at end of file
+};
diff --git a/test_app/public/javascripts/effects.js b/test_app/public/javascripts/effects.js
index c81e6c7..c977462 100644
--- a/test_app/public/javascripts/effects.js
+++ b/test_app/public/javascripts/effects.js
@@ -1120,4 +1120,4 @@ $w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTex
function(f) { Effect.Methods[f] = Element[f]; }
);
-Element.addMethods(Effect.Methods);
\ No newline at end of file
+Element.addMethods(Effect.Methods);
diff --git a/test_app/spec/controllers/controller_spec.rb b/test_app/spec/controllers/controller_spec.rb
index 5b35182..d2ef67e 100644
--- a/test_app/spec/controllers/controller_spec.rb
+++ b/test_app/spec/controllers/controller_spec.rb
@@ -95,9 +95,9 @@ describe WidgetsController do
get "show", :id=> 1
Impression.all.size.should eq 11
end
-
+
describe "impressionist unique options" do
-
+
it "should log unique impressions at the per action level" do
get "show", :id=> 1
Impression.all.size.should eq 12
@@ -108,7 +108,7 @@ describe WidgetsController do
get "index"
Impression.all.size.should eq 14
end
-
+
it "should log unique impressions only once per id" do
get "show", :id=> 1
Impression.all.size.should eq 12
@@ -119,7 +119,7 @@ describe WidgetsController do
get "index"
Impression.all.size.should eq 14
end
-
+
end
-
+
end
diff --git a/test_app/spec/fixtures/articles.yml b/test_app/spec/fixtures/articles.yml
index 86f1482..0a0867d 100644
--- a/test_app/spec/fixtures/articles.yml
+++ b/test_app/spec/fixtures/articles.yml
@@ -1,3 +1,3 @@
one:
id: 1
- name: Test Article
\ No newline at end of file
+ name: Test Article
diff --git a/test_app/spec/fixtures/impressions.yml b/test_app/spec/fixtures/impressions.yml
index 21bf9e1..7342af5 100644
--- a/test_app/spec/fixtures/impressions.yml
+++ b/test_app/spec/fixtures/impressions.yml
@@ -16,7 +16,7 @@ impression8:
session_hash: b1
ip_address: 127.0.0.1
created_at: 2010-01-01
-
+
impression9:
impressionable_type: Article
impressionable_id: 1
@@ -24,20 +24,20 @@ impression9:
session_hash: b2
ip_address: 127.0.0.1
created_at: 2011-01-03
-
+
impression10:
impressionable_type: Article
impressionable_id: 1
request_hash: a9
session_hash: b3
ip_address: 127.0.0.8
- created_at: 2010-01-01
-
+ created_at: 2010-01-01
+
impression11:
impressionable_type: Article
impressionable_id: 1
request_hash: a10
- session_hash: b4
+ session_hash: b4
ip_address: 127.0.0.1
- created_at: 2010-01-01
-
\ No newline at end of file
+ created_at: 2010-01-01
+
diff --git a/test_app/spec/fixtures/posts.yml b/test_app/spec/fixtures/posts.yml
index 6b70243..b85e679 100644
--- a/test_app/spec/fixtures/posts.yml
+++ b/test_app/spec/fixtures/posts.yml
@@ -1,3 +1,3 @@
one:
id: 1
- name: Test Post
\ No newline at end of file
+ name: Test Post
diff --git a/test_app/spec/fixtures/widgets.yml b/test_app/spec/fixtures/widgets.yml
index e93905c..1196246 100644
--- a/test_app/spec/fixtures/widgets.yml
+++ b/test_app/spec/fixtures/widgets.yml
@@ -1,4 +1,4 @@
one:
id: 1
name: A Widget
- impressions_count: 0
\ No newline at end of file
+ impressions_count: 0
diff --git a/test_app/spec/intializers/initializers_spec.rb b/test_app/spec/intializers/initializers_spec.rb
index bfd9505..429814a 100644
--- a/test_app/spec/intializers/initializers_spec.rb
+++ b/test_app/spec/intializers/initializers_spec.rb
@@ -5,14 +5,14 @@ describe Impressionist do
method = RUBY_VERSION.match("1.8") ? "is_impressionable" : :is_impressionable
ActiveRecord::Base.methods.include?(method).should be true
end
-
+
it "should include methods in ApplicationController" do
method = RUBY_VERSION.match("1.8") ? "impressionist" : :impressionist
ApplicationController.instance_methods.include?(method).should be true
end
-
+
it "should include the before_filter method in ApplicationController" do
filters = ApplicationController._process_action_callbacks.select { |c| c.kind == :before }
filters.collect{|filter|filter.filter}.include?(:impressionist_app_filter).should be true
end
-end
\ No newline at end of file
+end
diff --git a/test_app/spec/models/counter_caching_spec.rb b/test_app/spec/models/counter_caching_spec.rb
index 9c27a61..88cbd73 100644
--- a/test_app/spec/models/counter_caching_spec.rb
+++ b/test_app/spec/models/counter_caching_spec.rb
@@ -27,4 +27,4 @@ describe Impression do
end
end
-end
\ No newline at end of file
+end
diff --git a/test_app/spec/models/model_spec.rb b/test_app/spec/models/model_spec.rb
index 1fdb9c2..5460166 100644
--- a/test_app/spec/models/model_spec.rb
+++ b/test_app/spec/models/model_spec.rb
@@ -2,33 +2,33 @@ require 'spec_helper'
describe Impression do
fixtures :articles,:impressions,:posts
-
+
before(:each) do
@article = Article.find(1)
end
-
+
it "should save a blank impression for an Article that has 10 impressions" do
@article.impressions.create
@article.impressions.size.should eq 12
end
-
+
it "should save an impression with a message" do
@article.impressions.create(:message=>"test message")
@article.impressions.last.message.should eq "test message"
end
-
+
it "should return the impression count for all with no date range specified" do
@article.impressionist_count(:filter=>:all).should eq 11
end
-
+
it "should return unique impression count with no date range specified" do
@article.impressionist_count.should eq 9
end
-
+
it "should return impression count with only start date specified" do
@article.impressionist_count(:start_date=>"2011-01-01",:filter=>:all).should eq 8
end
-
+
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
end
@@ -36,11 +36,11 @@ describe Impression do
it "should return unique impression count with only start date specified" do
@article.impressionist_count(:start_date=>"2011-01-01").should eq 7
end
-
+
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
end
-
+
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
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
@article.impressionist_count(:filter=>:session_hash).should eq 7
end
-
+
# tests :dependent => :destroy
it "should delete impressions on deletion of impressionable" do
impressions_count = Impression.all.size
@@ -58,20 +58,20 @@ describe Impression do
a.destroyed?.should be_true
i.destroyed?.should be_true
end
-
+
#OLD COUNT METHODS. DEPRECATE SOON
it "should return the impression count with no date range specified" do
@article.impression_count.should eq 11
end
-
+
it "should return unique impression count with no date range specified" do
@article.unique_impression_count.should eq 9
end
-
+
it "should return impression count with only start date specified" do
@article.impression_count("2011-01-01").should eq 8
end
-
+
it "should return impression count with whole date range specified" do
@article.impression_count("2011-01-01","2011-01-02").should eq 7
end
@@ -79,11 +79,11 @@ describe Impression do
it "should return unique impression count with only start date specified" do
@article.unique_impression_count("2011-01-01").should eq 7
end
-
+
it "should return unique impression count with date range specified" do
@article.unique_impression_count("2011-01-01","2011-01-02").should eq 7
end
-
+
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
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
@article.unique_impression_count_session.should eq 7
end
-end
\ No newline at end of file
+end
diff --git a/test_app/spec/rails_generators/rails_generators_spec.rb b/test_app/spec/rails_generators/rails_generators_spec.rb
index 38ffbff..ac3c00b 100644
--- a/test_app/spec/rails_generators/rails_generators_spec.rb
+++ b/test_app/spec/rails_generators/rails_generators_spec.rb
@@ -13,9 +13,9 @@ describe Impressionist do
migration_name = generator_output.split("migrate/")[1].strip
Dir.entries(migrations_dir).include?(migration_name).should be true
end
-
+
it "should run the migration created in the previous spec" do
migrate_output = systemu("rake db:migrate RAILS_ENV=test")
migrate_output[1].include?("CreateImpressionsTable: migrated").should be true
end
-end
\ No newline at end of file
+end
diff --git a/test_app/spec/spec_helper.rb b/test_app/spec/spec_helper.rb
index f24601c..88bf38e 100644
--- a/test_app/spec/spec_helper.rb
+++ b/test_app/spec/spec_helper.rb
@@ -24,10 +24,10 @@ RSpec.configure do |config|
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
-
+
# make the rails logger usable in the tests as logger.xxx "..."
def logger
Rails.logger
end
-
+
end
diff --git a/upgrade_migrations/version_0_3_0.rb b/upgrade_migrations/version_0_3_0.rb
index 63c8e51..4668125 100644
--- a/upgrade_migrations/version_0_3_0.rb
+++ b/upgrade_migrations/version_0_3_0.rb
@@ -5,23 +5,23 @@ class CreateImpressionsTable < ActiveRecord::Migration
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, :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,: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
def self.down
remove_column :impressions, :session_hash
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 => :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, :name => :controlleraction_session_index
remove_index :impressions, :user_id
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
\ No newline at end of file
+end
diff --git a/upgrade_migrations/version_0_4_0.rb b/upgrade_migrations/version_0_4_0.rb
index 32dcab9..ebd7fac 100644
--- a/upgrade_migrations/version_0_4_0.rb
+++ b/upgrade_migrations/version_0_4_0.rb
@@ -1,9 +1,9 @@
class Version04UpdateImpressionsTable < ActiveRecord::Migration
def self.up
- add_column :impressions, :referrer, :string
+ add_column :impressions, :referrer, :string
end
def self.down
remove_column :impressions, :referrer
end
-end
\ No newline at end of file
+end