sequenced 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YjQwMmU1NzFiNzlmNDk3NDczOGJhOWY4NDhjODZhNmZjNjQ0NTllMA==
5
- data.tar.gz: !binary |-
6
- MGQ5Y2M4MjVkMGMzZWQ2MzA0MmE4Zjg4OTk2NzJmZTIyNDgwYTYwMQ==
2
+ SHA1:
3
+ metadata.gz: 75bc9373c8fb1dcbebb9cbfb7742d7d162546a24
4
+ data.tar.gz: 892d83d72c3219cc05124b9ff417de1f40bdfcc4
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NjA5OGJkMDc5MTM3MTY0Y2EwNDY2YTBkODk4YzA3YTY4MjUxNTdiNWQ2YzI5
10
- ZjhjNjFkM2JlZWRhODc2ODc0MDEwZDFlMzQ1ZGZmODRkNWYzZWQyMWM5NDlm
11
- NDIxMTA5ZDNhMmIwYjdhYzMyZWI2YTc2NzNjZWU2NmVkNjRmZWY=
12
- data.tar.gz: !binary |-
13
- OGU4MjNkMWY5Y2ZmMzRmNTY5NGQwOGQwNjE3YzhlYzg2YTZkNTUxOTVjMmFl
14
- OWYzZjUxNmFhMzI3NGEwNTUzMzZjODgzNmNmZmFkMTRiNDIxNjU3NDgzYTBl
15
- Mzc0MWQ2MjIxOTc4ZWE0Y2MyNDIyMGViMDM0Yzc1OWIwMTYzMTI=
6
+ metadata.gz: 15d113af75d91959ee8335119bad539915421145638d9ece2d92c4860ab7256b282aa3c44ccf2121db45ae09351cc5e475cf7d1e8dab7dfb16ba46898a22da33
7
+ data.tar.gz: a2c3d6132035d47ff11d8ccdd67385df43d1e1e32e41fac37b45d2faf99ab5227f733e99a3a66cd4e9098279fee1a940c5dadb94e6f2a9ecd5be512d4b3966e3
data/.gitignore CHANGED
@@ -8,3 +8,5 @@ test/dummy/log/*.log
8
8
  test/dummy/tmp/
9
9
  test/dummy/.sass-cache
10
10
  *.gem
11
+ .ruby-version
12
+ .ruby-gemset
@@ -1,3 +1,9 @@
1
+ 1.6.0 (April 10, 2014)
2
+ ----------------------
3
+
4
+ * Move generation callback from `before_save` to `before_validation` to
5
+ allow validations to utilize the sequential id (makebytes)
6
+
1
7
  1.5.0 (December 26, 2013)
2
8
  -------------------------
3
9
 
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/djreimer/sequenced.png)](https://travis-ci.org/djreimer/sequenced)
4
4
  [![Code Climate](https://codeclimate.com/github/djreimer/sequenced.png)](https://codeclimate.com/github/djreimer/sequenced)
5
+ [![Gem Version](https://badge.fury.io/rb/sequenced.png)](http://badge.fury.io/rb/sequenced)
5
6
 
6
7
  Sequenced is a simple gem that generates scoped sequential IDs for
7
8
  ActiveRecord models. This gem provides an `acts_as_sequenced` macro that
@@ -165,7 +166,7 @@ instead of by their primary keys:
165
166
 
166
167
  ## License
167
168
 
168
- Copyright © 2012-2013 Derrick Reimer
169
+ Copyright © 2011-2014 Derrick Reimer
169
170
 
170
171
  Permission is hereby granted, free of charge, to any person obtaining
171
172
  a copy of this software and associated documentation files (the
@@ -34,7 +34,7 @@ module Sequenced
34
34
  cattr_accessor :sequenced_options
35
35
  self.sequenced_options = options
36
36
 
37
- before_save :set_sequential_id
37
+ before_validation :set_sequential_id
38
38
  include Sequenced::ActsAsSequenced::InstanceMethods
39
39
  end
40
40
  end
@@ -45,4 +45,4 @@ module Sequenced
45
45
  end
46
46
  end
47
47
  end
48
- end
48
+ end
@@ -1,3 +1,3 @@
1
1
  module Sequenced
2
- VERSION = "1.5.0"
2
+ VERSION = "1.6.0"
3
3
  end
@@ -129,4 +129,10 @@ class ActsAsSequencedTest < ActiveSupport::TestCase
129
129
  assert_equal 1, zombie.sequential_id
130
130
  assert_equal 2, werewolf.sequential_id
131
131
  end
132
+
133
+ test "validation passing" do
134
+ obj = Policeman.create
135
+ assert_empty obj.errors[:sequential_id]
136
+ assert obj.valid?
137
+ end
132
138
  end
@@ -0,0 +1,5 @@
1
+ class Policeman < ActiveRecord::Base
2
+ acts_as_sequenced
3
+
4
+ validates :sequential_id, presence: true
5
+ end
@@ -1,5 +1,6 @@
1
1
  Dummy::Application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb
3
+ config.eager_load = false
3
4
 
4
5
  # The test environment is used exclusively to run your application's
5
6
  # test suite. You never need to work with it otherwise. Remember that
@@ -30,7 +31,7 @@ Dummy::Application.configure do
30
31
  config.action_mailer.delivery_method = :test
31
32
 
32
33
  # Raise exception on mass assignment protection for Active Record models
33
- config.active_record.mass_assignment_sanitizer = :strict
34
+ # config.active_record.mass_assignment_sanitizer = :strict
34
35
 
35
36
  # Print deprecation notices to the stderr
36
37
  config.active_support.deprecation = :stderr
@@ -0,0 +1,9 @@
1
+ class CreatePolicemen < ActiveRecord::Migration
2
+ def change
3
+ create_table :policemen do |t|
4
+ t.integer :sequential_id
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequenced
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derrick Reimer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-26 00:00:00.000000000 Z
11
+ date: 2014-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sqlite3
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: Sequenced is a gem that generates scoped sequential IDs for ActiveRecord
@@ -104,6 +104,7 @@ files:
104
104
  - test/dummy/app/models/invoice.rb
105
105
  - test/dummy/app/models/monster.rb
106
106
  - test/dummy/app/models/order.rb
107
+ - test/dummy/app/models/policeman.rb
107
108
  - test/dummy/app/models/product.rb
108
109
  - test/dummy/app/models/question.rb
109
110
  - test/dummy/app/models/rating.rb
@@ -141,6 +142,7 @@ files:
141
142
  - test/dummy/db/migrate/20130715002029_create_ratings.rb
142
143
  - test/dummy/db/migrate/20130730004055_create_products.rb
143
144
  - test/dummy/db/migrate/20131226000000_create_monsters.rb
145
+ - test/dummy/db/migrate/20140404195334_create_policemen.rb
144
146
  - test/dummy/db/schema.rb
145
147
  - test/dummy/lib/assets/.gitkeep
146
148
  - test/dummy/log/.gitkeep
@@ -164,17 +166,17 @@ require_paths:
164
166
  - lib
165
167
  required_ruby_version: !ruby/object:Gem::Requirement
166
168
  requirements:
167
- - - ! '>='
169
+ - - '>='
168
170
  - !ruby/object:Gem::Version
169
171
  version: '0'
170
172
  required_rubygems_version: !ruby/object:Gem::Requirement
171
173
  requirements:
172
- - - ! '>='
174
+ - - '>='
173
175
  - !ruby/object:Gem::Version
174
176
  version: '0'
175
177
  requirements: []
176
178
  rubyforge_project:
177
- rubygems_version: 2.1.10
179
+ rubygems_version: 2.0.3
178
180
  signing_key:
179
181
  specification_version: 4
180
182
  summary: Generate scoped sequential IDs for ActiveRecord models
@@ -192,6 +194,7 @@ test_files:
192
194
  - test/dummy/app/models/invoice.rb
193
195
  - test/dummy/app/models/monster.rb
194
196
  - test/dummy/app/models/order.rb
197
+ - test/dummy/app/models/policeman.rb
195
198
  - test/dummy/app/models/product.rb
196
199
  - test/dummy/app/models/question.rb
197
200
  - test/dummy/app/models/rating.rb
@@ -230,6 +233,7 @@ test_files:
230
233
  - test/dummy/db/migrate/20130715002029_create_ratings.rb
231
234
  - test/dummy/db/migrate/20130730004055_create_products.rb
232
235
  - test/dummy/db/migrate/20131226000000_create_monsters.rb
236
+ - test/dummy/db/migrate/20140404195334_create_policemen.rb
233
237
  - test/dummy/db/schema.rb
234
238
  - test/dummy/db/test.sqlite3
235
239
  - test/dummy/log/development.log