effective_obfuscation 1.1.1 → 1.1.2

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: 8a8a46e6ba1ed3aa77b6ad566309801761cd3ef0
4
- data.tar.gz: 72f5a654333f4536c127f840bd05d423c8a5bc99
3
+ metadata.gz: 9993a73260698ae5551f4f53fa16009e7cefb1ee
4
+ data.tar.gz: 8251eb929a814ce1fa0b166ffd66404ac77f55e0
5
5
  SHA512:
6
- metadata.gz: d3f04d5eaf2cd557ca877f296eda8025376e604e3d35349f610bad983f5e394b1dc811319df1dc757b17d7c64840606fe34b54967fb7b3d704a89b25ac9a1e47
7
- data.tar.gz: f174ffc2a57754cd2b55d78bebec0f715c590bf87d9756a29c66f73edd86ecc2725f8e5b72b7156e18d37c2cf900174daa1ed8920a8b827e3a34b791429ca204
6
+ metadata.gz: 4e3abfc550594ef29c82d63ff83c0042fdae23e5c659c5fed8cd846242d410b8dd9212acf429fbc4d670d27fb5c1540837fe76790959c3f0a616afea55371f5b
7
+ data.tar.gz: 1f81daeeb4da26833dc9d40aad0034ae7423395079573464e69007f407a983a3e7a7575d656a2954e7bf3387018fb4c1d3a06885b0dcd97f007285c2d1585bd6
@@ -47,7 +47,10 @@ module ActsAsObfuscated
47
47
 
48
48
  # Work with Ransack if available
49
49
  if self.respond_to?(:ransacker)
50
- ransacker :id, :formatter => Proc.new { |v| deobfuscate(v) } { |parent| parent.table[:id] }
50
+ ransacker :id, :formatter => Proc.new { |original|
51
+ obfuscated_id = original.to_s.delete('^0-9').first(10)
52
+ obfuscated_id.length == 10 ? deobfuscate(original) : 0
53
+ } { |parent| parent.table[:id] }
51
54
  end
52
55
 
53
56
  if ::ActiveRecord::VERSION::MAJOR == 4 && ::ActiveRecord::VERSION::MINOR == 2
@@ -98,6 +101,7 @@ module ActsAsObfuscated
98
101
  reflect_on_all_associations(:belongs_to).each do |reflection|
99
102
  if reflection.klass.respond_to?(:deobfuscate)
100
103
  deobfuscators[reflection.foreign_key] = Proc.new { |right| reflection.klass.deobfuscate(right) }
104
+ # Should override the foreign_object_id= method and deobfuscate it too
101
105
  end
102
106
  end
103
107
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveObfuscation
2
- VERSION = '1.1.1'.freeze
2
+ VERSION = '1.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_obfuscation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-08 00:00:00.000000000 Z
11
+ date: 2016-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -47,13 +47,13 @@ executables: []
47
47
  extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
+ - MIT-LICENSE
51
+ - README.md
52
+ - Rakefile
50
53
  - app/models/concerns/acts_as_obfuscated.rb
54
+ - lib/effective_obfuscation.rb
51
55
  - lib/effective_obfuscation/engine.rb
52
56
  - lib/effective_obfuscation/version.rb
53
- - lib/effective_obfuscation.rb
54
- - MIT-LICENSE
55
- - Rakefile
56
- - README.md
57
57
  - spec/effective_obfuscation_spec.rb
58
58
  - spec/spec_helper.rb
59
59
  homepage: https://github.com/code-and-effect/effective_obfuscation
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  version: '0'
77
77
  requirements: []
78
78
  rubyforge_project:
79
- rubygems_version: 2.0.14
79
+ rubygems_version: 2.4.6
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: Display unique 10-digit numbers instead of ActiveRecord IDs. Hides the ID