acts_as_sequence 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.rdoc +10 -11
- data/lib/acts_as_sequence.rb +1 -1
- data/lib/acts_as_sequence/{acts_as_sequence.rb → extension.rb} +1 -1
- data/lib/acts_as_sequence/railtie.rb +1 -1
- data/lib/acts_as_sequence/version.rb +1 -1
- data/spec/acts_as_sequence/{acts_as_sequence_spec.rb → extension_spec.rb} +0 -0
- data/spec/spec_helper.rb +1 -1
- metadata +4 -5
- data/init.rb +0 -1
data/README.rdoc
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
Emulates database sequences for MySQL. It is useful when you want to have a unique value for an unsaved object.
|
4
4
|
|
5
|
-
rails g model Sequence id_order:integer
|
6
|
-
|
7
5
|
= Installation
|
8
6
|
|
9
7
|
gem 'acts_as_sequence'
|
@@ -14,14 +12,15 @@ gem 'acts_as_sequence'
|
|
14
12
|
|
15
13
|
app/models/sequence.rb:
|
16
14
|
|
17
|
-
class Sequence < ActiveRecord::Base
|
18
|
-
|
19
|
-
end
|
15
|
+
class Sequence < ActiveRecord::Base
|
16
|
+
acts_as_sequencer
|
17
|
+
end
|
20
18
|
|
21
|
-
class Order < ActiveRecord::Base
|
22
|
-
|
23
|
-
end
|
19
|
+
class Order < ActiveRecord::Base
|
20
|
+
acts_as_sequenced :uniq_id, Sequence
|
21
|
+
end
|
24
22
|
|
25
|
-
|
26
|
-
Order.new.uniq_id.should ==
|
27
|
-
|
23
|
+
Following tests pass:
|
24
|
+
Order.new.uniq_id.should == 0
|
25
|
+
Order.new.uniq_id.should == 1
|
26
|
+
Sequence.next_sequence_value(:uniq_id).should == 2
|
data/lib/acts_as_sequence.rb
CHANGED
File without changes
|
data/spec/spec_helper.rb
CHANGED
@@ -13,7 +13,7 @@ end
|
|
13
13
|
|
14
14
|
require 'active_record'
|
15
15
|
|
16
|
-
ActiveRecord::Base.send(:include, ActsAsSequence::
|
16
|
+
ActiveRecord::Base.send(:include, ActsAsSequence::Extension)
|
17
17
|
ActiveRecord::Base.establish_connection(
|
18
18
|
"adapter" => "sqlite3",
|
19
19
|
"database" => ":memory:"
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: acts_as_sequence
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Victor Sokolov
|
@@ -73,12 +73,11 @@ files:
|
|
73
73
|
- README.rdoc
|
74
74
|
- Rakefile
|
75
75
|
- acts_as_sequence.gemspec
|
76
|
-
- init.rb
|
77
76
|
- lib/acts_as_sequence.rb
|
78
|
-
- lib/acts_as_sequence/
|
77
|
+
- lib/acts_as_sequence/extension.rb
|
79
78
|
- lib/acts_as_sequence/railtie.rb
|
80
79
|
- lib/acts_as_sequence/version.rb
|
81
|
-
- spec/acts_as_sequence/
|
80
|
+
- spec/acts_as_sequence/extension_spec.rb
|
82
81
|
- spec/schema.rb
|
83
82
|
- spec/spec_helper.rb
|
84
83
|
has_rdoc: true
|
@@ -110,6 +109,6 @@ signing_key:
|
|
110
109
|
specification_version: 3
|
111
110
|
summary: Database sequence emulation for MySQL
|
112
111
|
test_files:
|
113
|
-
- spec/acts_as_sequence/
|
112
|
+
- spec/acts_as_sequence/extension_spec.rb
|
114
113
|
- spec/schema.rb
|
115
114
|
- spec/spec_helper.rb
|
data/init.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "lib", "paperclip-meta")
|