auto_increment 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/Appraisals +5 -0
- data/README.md +2 -2
- data/auto_increment.gemspec +2 -2
- data/gemfiles/rails_5.1.gemfile +12 -0
- data/lib/auto_increment/active_record.rb +2 -2
- data/lib/auto_increment/incrementor.rb +4 -4
- data/lib/auto_increment/version.rb +1 -1
- data/spec/db/sync.db +0 -0
- data/spec/lib/active_record_spec.rb +0 -2
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a59855c0d5c6791ba684802c30616f621657794
|
4
|
+
data.tar.gz: 166fb4fbcc37d7c603b1c37dce095eb0f205ad78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5d2caa72b8ef693a4ecf39bd278fd238356d966e00d8de12c7415cc3037644f7127a35425a883c06a17ab7ce1d4b5cf3400cc782312d4b594780792b0083e58
|
7
|
+
data.tar.gz: 8fca057d42bcf44c715b0c611d66b7ea98debab9a91db49d7e8037f0f45d0de279c56d7417dce412d3cc0c1e561bda2167a1d0d128504e9855474769a5782134
|
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
data/README.md
CHANGED
@@ -51,8 +51,8 @@ First argument is the column that will be incremented. Can be integer or string.
|
|
51
51
|
|
52
52
|
## Compatibility
|
53
53
|
|
54
|
-
Tested with Rails 4 and Rails 5 in Ruby 2.2.5 and Ruby 2.3.1
|
54
|
+
Tested with Rails 4, Rails 5 and Rails 5.1 in Ruby 2.2.5 and Ruby 2.3.1
|
55
55
|
|
56
56
|
## License
|
57
57
|
|
58
|
-
MIT License
|
58
|
+
MIT License
|
data/auto_increment.gemspec
CHANGED
@@ -18,8 +18,8 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
s.require_paths = ['lib']
|
20
20
|
|
21
|
-
s.add_dependency 'activerecord', '>= 4.0', '< 5.
|
22
|
-
s.add_dependency 'activesupport', '>= 4.0', '< 5.
|
21
|
+
s.add_dependency 'activerecord', '>= 4.0', '< 5.2'
|
22
|
+
s.add_dependency 'activesupport', '>= 4.0', '< 5.2'
|
23
23
|
|
24
24
|
s.add_development_dependency 'bundler'
|
25
25
|
s.add_development_dependency 'rake'
|
@@ -8,9 +8,9 @@ module AutoIncrement
|
|
8
8
|
def auto_increment(column = nil, options = {})
|
9
9
|
options.reverse_merge! before: :create
|
10
10
|
|
11
|
-
callback = "before_#{
|
11
|
+
callback = "before_#{options[:before]}"
|
12
12
|
|
13
|
-
|
13
|
+
send callback, Incrementor.new(column, options)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -18,8 +18,8 @@ module AutoIncrement
|
|
18
18
|
write if can_write?
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
alias before_validation before_create
|
22
|
+
alias before_save before_create
|
23
23
|
|
24
24
|
private
|
25
25
|
|
@@ -47,8 +47,8 @@ module AutoIncrement
|
|
47
47
|
|
48
48
|
if string?
|
49
49
|
query.select("#{@column} max")
|
50
|
-
|
51
|
-
|
50
|
+
.order("LENGTH(#{@column}) DESC, #{@column} DESC")
|
51
|
+
.first.try :max
|
52
52
|
else
|
53
53
|
query.maximum @column
|
54
54
|
end
|
data/spec/db/sync.db
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auto_increment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felipe Diesel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '4.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '5.
|
22
|
+
version: '5.2'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '4.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '5.
|
32
|
+
version: '5.2'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: activesupport
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: '4.0'
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '5.
|
42
|
+
version: '5.2'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
version: '4.0'
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '5.
|
52
|
+
version: '5.2'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: bundler
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- Rakefile
|
210
210
|
- auto_increment.gemspec
|
211
211
|
- gemfiles/rails_4.gemfile
|
212
|
+
- gemfiles/rails_5.1.gemfile
|
212
213
|
- gemfiles/rails_5.gemfile
|
213
214
|
- lib/auto_increment.rb
|
214
215
|
- lib/auto_increment/active_record.rb
|
@@ -242,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
243
|
version: '0'
|
243
244
|
requirements: []
|
244
245
|
rubyforge_project:
|
245
|
-
rubygems_version: 2.5.
|
246
|
+
rubygems_version: 2.5.2
|
246
247
|
signing_key:
|
247
248
|
specification_version: 4
|
248
249
|
summary: Auto increment a string or integer field
|