impressionist 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +8 -1
- data/README.md +2 -1
- data/UPGRADE_GUIDE.md +13 -0
- data/app/controllers/impressionist_controller.rb +2 -1
- data/lib/generators/active_record/templates/create_impressions_table.rb +1 -1
- data/lib/impressionist/models/mongoid/impression.rb +1 -0
- data/lib/impressionist/setup_association.rb +5 -1
- data/lib/impressionist/version.rb +1 -1
- data/tests/spec/minitest_helper.rb +3 -0
- data/tests/test_app/spec/controllers/articles_controller_spec.rb +16 -0
- data/upgrade_migrations/version_1_5_2.rb +12 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ece53bd074111938c17d3cbd3b97949cdd87b94b
|
4
|
+
data.tar.gz: e3f6c58a7dee094cbd9f34414d455edbc64402ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b104697a66dc806f93d6da4666cf2fb39610f0a63641f276b7f9b2ca627d964aded1c995bc83ec0bfbae984111d60804f3bac714f2b344d1801a429c8d4170c6
|
7
|
+
data.tar.gz: d877a077d993b98d466b614c392325aad1123bd3894503c51ee95cb893a5b04d4303e637bc58d2189e41f42d320cf3649dffd573ff5aabf74883a6292838947e
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
-
== 1.6.
|
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
|
-
* [
|
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
|
|
data/UPGRADE_GUIDE.md
ADDED
@@ -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
|
@@ -12,7 +12,11 @@ module Impressionist
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def define_belongs_to
|
15
|
-
|
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
|
@@ -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.
|
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:
|
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.
|
212
|
+
rubygems_version: 2.6.11
|
211
213
|
signing_key:
|
212
214
|
specification_version: 4
|
213
215
|
summary: Easy way to log impressions
|