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.
@@ -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
- acts_as_sequencer
19
- end
15
+ class Sequence < ActiveRecord::Base
16
+ acts_as_sequencer
17
+ end
20
18
 
21
- class Order < ActiveRecord::Base
22
- acts_as_sequenced :uniq_id, Sequence
23
- end
19
+ class Order < ActiveRecord::Base
20
+ acts_as_sequenced :uniq_id, Sequence
21
+ end
24
22
 
25
- Order.new.uniq_id.should == 0
26
- Order.new.uniq_id.should == 1
27
- Sequence.next_sequence_value(:uniq_id).should == 2
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
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module ActsAsSequence
3
- require 'acts_as_sequence/acts_as_sequence'
3
+ require 'acts_as_sequence/extension'
4
4
  require 'acts_as_sequence/version'
5
5
  require 'acts_as_sequence/railtie' if defined?(Rails)
6
6
  end
@@ -2,7 +2,7 @@
2
2
  require 'active_support/concern'
3
3
 
4
4
  module ActsAsSequence
5
- module ActsAsSequence
5
+ module Extension
6
6
  extend ::ActiveSupport::Concern
7
7
 
8
8
  module ClassMethods
@@ -2,7 +2,7 @@
2
2
  module ActsAsSequence
3
3
  class Railtie < ::Rails::Railtie
4
4
  ActiveSupport.on_load :active_record do
5
- ::ActiveRecord::Base.send(:include, ActsAsSequence::ActsAsSequence)
5
+ ::ActiveRecord::Base.send(:include, ActsAsSequence::Extension)
6
6
  end
7
7
  end
8
8
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module ActsAsSequence
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
@@ -13,7 +13,7 @@ end
13
13
 
14
14
  require 'active_record'
15
15
 
16
- ActiveRecord::Base.send(:include, ActsAsSequence::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.1
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/acts_as_sequence.rb
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/acts_as_sequence_spec.rb
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/acts_as_sequence_spec.rb
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")