fingerprints 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/fingerprints/version.rb +1 -1
- data/lib/fingerprints.rb +4 -4
- data/test/test_fingerprints.rb +14 -0
- metadata +3 -3
data/README.md
CHANGED
@@ -59,7 +59,7 @@ automatically. You can also do this:
|
|
59
59
|
|
60
60
|
The default `:class_name` is 'User' and can be overridden like this:
|
61
61
|
|
62
|
-
|
62
|
+
HasFingerprints::OPTIONS.merge!(:class_name => 'Person')
|
63
63
|
|
64
64
|
## Contributing
|
65
65
|
|
data/lib/fingerprints/version.rb
CHANGED
data/lib/fingerprints.rb
CHANGED
@@ -3,11 +3,11 @@ require 'fingerprints/active_record'
|
|
3
3
|
require 'fingerprints/version'
|
4
4
|
|
5
5
|
module Fingerprints
|
6
|
-
|
6
|
+
OPTIONS = {
|
7
|
+
:class_name => 'User'
|
8
|
+
}
|
7
9
|
|
8
|
-
|
9
|
-
:class_name => 'User'
|
10
|
-
}
|
10
|
+
module Extensions
|
11
11
|
|
12
12
|
def self.included(base)
|
13
13
|
base.extend(ClassMethods)
|
data/test/test_fingerprints.rb
CHANGED
@@ -32,6 +32,11 @@ class User < ActiveRecord::Base
|
|
32
32
|
def self.table_name() "users" end
|
33
33
|
end
|
34
34
|
|
35
|
+
class Person < ActiveRecord::Base
|
36
|
+
has_fingerprints
|
37
|
+
def self.table_name() "person" end
|
38
|
+
end
|
39
|
+
|
35
40
|
class InvalidUser < ActiveRecord::Base
|
36
41
|
def self.table_name() "users" end
|
37
42
|
end
|
@@ -89,4 +94,13 @@ class HasFingerprintsTest < ActiveSupport::TestCase
|
|
89
94
|
end
|
90
95
|
end
|
91
96
|
|
97
|
+
def test_fingerprints_set_on_alternate_model
|
98
|
+
User.fingerprint = 5
|
99
|
+
Person.fingerprint = 6
|
100
|
+
Fingerprints::OPTIONS.merge!(:class_name => 'Person')
|
101
|
+
@widget.save!
|
102
|
+
assert_equal 6, @widget.created_by
|
103
|
+
end
|
104
|
+
|
105
|
+
|
92
106
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fingerprints
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -42,7 +42,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
42
42
|
version: '0'
|
43
43
|
segments:
|
44
44
|
- 0
|
45
|
-
hash: -
|
45
|
+
hash: -2472280275732682223
|
46
46
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
47
|
none: false
|
48
48
|
requirements:
|
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
version: '0'
|
52
52
|
segments:
|
53
53
|
- 0
|
54
|
-
hash: -
|
54
|
+
hash: -2472280275732682223
|
55
55
|
requirements: []
|
56
56
|
rubyforge_project:
|
57
57
|
rubygems_version: 1.8.24
|