impressionist 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ba9ef405e0268bd6e6c4f49f5af548c64b99489
4
- data.tar.gz: b23558b98793b625a57c55b14cbcded8c681f136
3
+ metadata.gz: ece53bd074111938c17d3cbd3b97949cdd87b94b
4
+ data.tar.gz: e3f6c58a7dee094cbd9f34414d455edbc64402ef
5
5
  SHA512:
6
- metadata.gz: 20b79abe821d51b958b217d28b447476ccb0cf85bb7bf0edf8ede971f68981533c42469341507dd1131f5718ca7deb5239d4549ec0b372cf001605afe5ae1968
7
- data.tar.gz: 2ecc6417699a4ad0059b15d685df29e9586ce8d6c5f158ccbaf770c84ceab5f06ac8bfb8b7e54ef02155f9a435e74db05e3189311cb95e335220a34cf0bfaff5
6
+ metadata.gz: b104697a66dc806f93d6da4666cf2fb39610f0a63641f276b7f9b2ca627d964aded1c995bc83ec0bfbae984111d60804f3bac714f2b344d1801a429c8d4170c6
7
+ data.tar.gz: d877a077d993b98d466b614c392325aad1123bd3894503c51ee95cb893a5b04d4303e637bc58d2189e41f42d320cf3649dffd573ff5aabf74883a6292838947e
@@ -1,4 +1,11 @@
1
- == 1.6.0 (2016-09-16)
1
+ == 1.6.1 (2018-04-16)
2
+ * Add belongs_to optional true to setup_association (#264, @josephMG)
3
+ * Add missing field for Mongoid (#254, @Fibrasek)
4
+ * Implemented patch that will add the Rails major version to the migration file (#248, @jordanhudgens)
5
+ * Add params filtering on new column (#246, @rposborne)
6
+ * Add a DB migration to add params to schema. (#245, @rposborne)
7
+
8
+ == 1.6.0 (2017-05-24)
2
9
  * Documentation example for counter_cache (#239, @fwolfst)
3
10
  * Green Travis CI builds (#238, @jgrau)
4
11
  * Rails 5.1 support (#241, @msimonborg)
data/README.md CHANGED
@@ -247,7 +247,8 @@ Want to run the tests? Ok mummy
247
247
  Contributors
248
248
  ------------
249
249
  * [johnmcaliley - creator](https://github.com/johnmcaliley)
250
- * [Antonio C Nalesso - maintainer](https://github.com/acnalesso)
250
+ * [jgrau - maintainer](https://github.com/jgrau)
251
+ * [acnalesso](https://github.com/acnalesso)
251
252
  * [coryschires](https://github.com/coryschires)
252
253
  * [georgmittendorfer](https://github.com/georgmittendorfer)
253
254
 
@@ -0,0 +1,13 @@
1
+ # Upgrade guide
2
+
3
+ ## v1.5.1 -> v1.5.2
4
+
5
+ Version 1.5.2 adds are new column to the `impressions` table. If you're on v1.5.1 you need to manually add the new column using
6
+
7
+ ```
8
+ add_column :impressions, :params, :text
9
+
10
+ add_index :impressions, [:impressionable_type, :impressionable_id, :params], :name => "poly_params_request_index", :unique => false
11
+ ```
12
+
13
+ before upgrading.
@@ -51,6 +51,7 @@ module ImpressionistController
51
51
 
52
52
  # creates a statment hash that contains default values for creating an impression via an AR relation.
53
53
  def associative_create_statement(query_params={})
54
+ filter = ActionDispatch::Http::ParameterFilter.new(Rails.application.config.filter_parameters)
54
55
  query_params.reverse_merge!(
55
56
  :controller_name => controller_name,
56
57
  :action_name => action_name,
@@ -59,7 +60,7 @@ module ImpressionistController
59
60
  :session_hash => session_hash,
60
61
  :ip_address => request.remote_ip,
61
62
  :referrer => request.referer,
62
- :params => params_hash
63
+ :params => filter.filter(params_hash)
63
64
  )
64
65
  end
65
66
 
@@ -1,4 +1,4 @@
1
- class CreateImpressionsTable < ActiveRecord::Migration
1
+ class CreateImpressionsTable < ActiveRecord::Migration<%= Rails::VERSION::MAJOR >= 5 ? "[#{Rails.version.to_f}]" : "" %>
2
2
  def self.up
3
3
  create_table :impressions, :force => true do |t|
4
4
  t.string :impressionable_type
@@ -19,6 +19,7 @@ class Impression
19
19
  field :session_hash
20
20
  field :message
21
21
  field :referrer
22
+ field :params
22
23
 
23
24
  after_save :impressionable_counter_cache_updatable?
24
25
 
@@ -12,7 +12,11 @@ module Impressionist
12
12
  end
13
13
 
14
14
  def define_belongs_to
15
- receiver.belongs_to(:impressionable, :polymorphic => true)
15
+ if ::Rails::VERSION::MAJOR.to_i >= 5
16
+ receiver.belongs_to(:impressionable, :polymorphic => true, :optional => true)
17
+ else
18
+ receiver.belongs_to(:impressionable, :polymorphic => true)
19
+ end
16
20
  end
17
21
 
18
22
  def set
@@ -1,3 +1,3 @@
1
1
  module Impressionist
2
- VERSION = "1.6.0"
2
+ VERSION = "1.6.1"
3
3
  end
@@ -1,4 +1,7 @@
1
1
  $:.unshift(File.dirname __FILE__)
2
2
 
3
+ require 'rails/all'
4
+ require 'rails/test_help'
3
5
  require "minitest/autorun"
4
6
  require "minitest/pride"
7
+ require 'minitest/rails'
@@ -71,4 +71,20 @@ describe ArticlesController do
71
71
  Impression.last.session_hash.size.should eq 32
72
72
  Impression.last.referrer.should eq nil
73
73
  end
74
+
75
+ describe "when filtering params" do
76
+ before do
77
+ @_filtered_params = Rails.application.config.filter_parameters
78
+ Rails.application.config.filter_parameters = [:password]
79
+ end
80
+
81
+ it "values should not be recorded" do
82
+ get "index", password: "best-password-ever"
83
+ Impression.last.params.should eq("password" => "[FILTERED]")
84
+ end
85
+
86
+ after do
87
+ Rails.application.config.filter_parameters = @_filtered_params
88
+ end
89
+ end
74
90
  end
@@ -0,0 +1,12 @@
1
+ class Version152UpdateImpressionsTable < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :impressions, :params, :text
4
+
5
+ add_index :impressions, [:impressionable_type, :impressionable_id, :params], :name => "poly_params_request_index", :unique => false
6
+ end
7
+
8
+ def self.down
9
+ remove_index :impressions, [:impressionable_type, :impressionable_id, :params], :name => "poly_params_request_index"
10
+ remove_column :impressions, :params
11
+ end
12
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: impressionist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - johnmcaliley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-24 00:00:00.000000000 Z
11
+ date: 2018-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -52,6 +52,7 @@ files:
52
52
  - LICENSE.txt
53
53
  - README.md
54
54
  - Rakefile
55
+ - UPGRADE_GUIDE.md
55
56
  - app/controllers/impressionist_controller.rb
56
57
  - app/models/impression.rb
57
58
  - app/models/impressionist/bots.rb
@@ -187,6 +188,7 @@ files:
187
188
  - tests/test_app/spec/spec_helper.rb
188
189
  - upgrade_migrations/version_0_3_0.rb
189
190
  - upgrade_migrations/version_0_4_0.rb
191
+ - upgrade_migrations/version_1_5_2.rb
190
192
  homepage: http://github.com/charlotte-ruby/impressionist
191
193
  licenses:
192
194
  - MIT
@@ -207,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
209
  version: 1.3.6
208
210
  requirements: []
209
211
  rubyforge_project:
210
- rubygems_version: 2.4.5.1
212
+ rubygems_version: 2.6.11
211
213
  signing_key:
212
214
  specification_version: 4
213
215
  summary: Easy way to log impressions