jt-rails-tokenizable 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/jt-rails-tokenizable.gemspec +1 -1
- data/lib/tokenize.rb +7 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 151a9e0db560d6792a31e425f1ce852768aa8636
|
4
|
+
data.tar.gz: bd936823c16acaa7fd2a2eb3775d201cddbb6362
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47b3f78f2135ce0fd58946ef0778111cb1275d95ed29350f479ec0f455c3a13826de903f0fe4d11c835c4b29754d677a2c96bb8e4aa477baffccb4fc9fadf6ba
|
7
|
+
data.tar.gz: 9ab91a6d14206824194209af203237d4f147f0ca2e40b3aaf769fa896ae937069ddb2cf6db6021bcc7dcbb629571f6b653947ac618946e0cf336ab64941196ba
|
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.summary = "Token generation for ActiveRecord models in Ruby On Rails"
|
4
4
|
s.description = "Generate tokens for ActiveRecord models in Ruby On Rails"
|
5
5
|
s.homepage = 'https://github.com/jonathantribouharet/jt-rails-tokenizable'
|
6
|
-
s.version = '1.
|
6
|
+
s.version = '1.2.0'
|
7
7
|
s.files = `git ls-files`.split("\n")
|
8
8
|
s.require_paths = ['lib']
|
9
9
|
s.authors = ['Jonathan TRIBOUHARET']
|
data/lib/tokenize.rb
CHANGED
@@ -2,7 +2,7 @@ module JT::Rails::Tokenizable::Tokenize
|
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
4
|
included do |base|
|
5
|
-
before_validation :
|
5
|
+
before_validation :jt_rails_generate_tokens_if_missing, on: :create
|
6
6
|
|
7
7
|
base.class_eval do
|
8
8
|
|
@@ -27,6 +27,12 @@ module JT::Rails::Tokenizable::Tokenize
|
|
27
27
|
|
28
28
|
end
|
29
29
|
|
30
|
+
def jt_rails_generate_tokens_if_missing
|
31
|
+
for field in self.class.jt_rails_token_fields.keys
|
32
|
+
generate_new_token(field) if self[field.to_sym].blank?
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
30
36
|
def jt_rails_generate_tokens
|
31
37
|
for field in self.class.jt_rails_token_fields.keys
|
32
38
|
generate_new_token(field)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jt-rails-tokenizable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan TRIBOUHARET
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Generate tokens for ActiveRecord models in Ruby On Rails
|
14
14
|
email: jonathan.tribouharet@gmail.com
|
@@ -43,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
43
|
version: '0'
|
44
44
|
requirements: []
|
45
45
|
rubyforge_project:
|
46
|
-
rubygems_version: 2.0.14
|
46
|
+
rubygems_version: 2.0.14.1
|
47
47
|
signing_key:
|
48
48
|
specification_version: 4
|
49
49
|
summary: Token generation for ActiveRecord models in Ruby On Rails
|