From d1f1a352d46a5909beb9a4f3fd12c16f67312aa6 Mon Sep 17 00:00:00 2001 From: Tute Costa Date: Mon, 12 Mar 2012 17:25:22 -0300 Subject: [PATCH 1/3] Removing useless files/folders. --- config/routes.rb | 2 -- lib/impressionist/railties/tasks.rake | 0 test_app/doc/README_FOR_APP | 2 -- test_app/test/fixtures/.gitkeep | 0 test_app/test/functional/.gitkeep | 0 test_app/test/integration/.gitkeep | 0 test_app/test/performance/browsing_test.rb | 12 ------------ test_app/test/test_helper.rb | 15 --------------- test_app/test/unit/.gitkeep | 0 test_app/vendor/assets/javascripts/.gitkeep | 0 test_app/vendor/assets/stylesheets/.gitkeep | 0 test_app/vendor/plugins/.gitkeep | 0 12 files changed, 31 deletions(-) delete mode 100644 config/routes.rb delete mode 100644 lib/impressionist/railties/tasks.rake delete mode 100644 test_app/doc/README_FOR_APP delete mode 100644 test_app/test/fixtures/.gitkeep delete mode 100644 test_app/test/functional/.gitkeep delete mode 100644 test_app/test/integration/.gitkeep delete mode 100644 test_app/test/performance/browsing_test.rb delete mode 100644 test_app/test/test_helper.rb delete mode 100644 test_app/test/unit/.gitkeep delete mode 100644 test_app/vendor/assets/javascripts/.gitkeep delete mode 100644 test_app/vendor/assets/stylesheets/.gitkeep delete mode 100644 test_app/vendor/plugins/.gitkeep diff --git a/config/routes.rb b/config/routes.rb deleted file mode 100644 index 1daf9a4..0000000 --- a/config/routes.rb +++ /dev/null @@ -1,2 +0,0 @@ -Rails.application.routes.draw do -end diff --git a/lib/impressionist/railties/tasks.rake b/lib/impressionist/railties/tasks.rake deleted file mode 100644 index e69de29..0000000 diff --git a/test_app/doc/README_FOR_APP b/test_app/doc/README_FOR_APP deleted file mode 100644 index fe41f5c..0000000 --- a/test_app/doc/README_FOR_APP +++ /dev/null @@ -1,2 +0,0 @@ -Use this README file to introduce your application and point to useful places in the API for learning more. -Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. diff --git a/test_app/test/fixtures/.gitkeep b/test_app/test/fixtures/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test_app/test/functional/.gitkeep b/test_app/test/functional/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test_app/test/integration/.gitkeep b/test_app/test/integration/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test_app/test/performance/browsing_test.rb b/test_app/test/performance/browsing_test.rb deleted file mode 100644 index 3fea27b..0000000 --- a/test_app/test/performance/browsing_test.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'test_helper' -require 'rails/performance_test_help' - -class BrowsingTest < ActionDispatch::PerformanceTest - # Refer to the documentation for all available options - # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory] - # :output => 'tmp/performance', :formats => [:flat] } - - def test_homepage - get '/' - end -end diff --git a/test_app/test/test_helper.rb b/test_app/test/test_helper.rb deleted file mode 100644 index 07bc61b..0000000 --- a/test_app/test/test_helper.rb +++ /dev/null @@ -1,15 +0,0 @@ -ENV["RAILS_ENV"] = "test" -require 'simplecov' -SimpleCov.start 'rails' -require File.expand_path('../../config/environment', __FILE__) -require 'rails/test_help' - -class ActiveSupport::TestCase - # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. - # - # Note: You'll currently still have to declare fixtures explicitly in integration tests - # -- they do not yet inherit this setting - fixtures :all - - # Add more helper methods to be used by all tests here... -end diff --git a/test_app/test/unit/.gitkeep b/test_app/test/unit/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test_app/vendor/assets/javascripts/.gitkeep b/test_app/vendor/assets/javascripts/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test_app/vendor/assets/stylesheets/.gitkeep b/test_app/vendor/assets/stylesheets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test_app/vendor/plugins/.gitkeep b/test_app/vendor/plugins/.gitkeep deleted file mode 100644 index e69de29..0000000 From 6a15cbaf3e9756d186e12823a35f115e9a378dd8 Mon Sep 17 00:00:00 2001 From: Tute Costa Date: Mon, 12 Mar 2012 17:30:12 -0300 Subject: [PATCH 2/3] Dropping a table automatically drops it's indexes. --- .../impressionist/templates/create_impressions_table.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/generators/impressionist/templates/create_impressions_table.rb b/lib/generators/impressionist/templates/create_impressions_table.rb index 72de511..e3fa7d5 100644 --- a/lib/generators/impressionist/templates/create_impressions_table.rb +++ b/lib/generators/impressionist/templates/create_impressions_table.rb @@ -24,14 +24,6 @@ class CreateImpressionsTable < ActiveRecord::Migration 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 From 952ce40ff9080989278d255ff68bf82c58c3dab1 Mon Sep 17 00:00:00 2001 From: Tute Costa Date: Mon, 12 Mar 2012 17:34:01 -0300 Subject: [PATCH 3/3] White listing all Impression attributes according to new Rails active_record.whitelist default. --- app/models/impression.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/impression.rb b/app/models/impression.rb index 98c3b33..25f8aeb 100644 --- a/app/models/impression.rb +++ b/app/models/impression.rb @@ -3,6 +3,10 @@ class Impression < ActiveRecord::Base after_save :update_impressions_counter_cache + attr_accessible :impressionable_type, :impressionable_id, :user_id, + :controller_name, :action_name, :view_name, :request_hash, :ip_address, + :session_hash, :message, :referrer + private def update_impressions_counter_cache