store-active_record 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/store/active_record/version.rb +1 -1
- data/lib/store/active_record.rb +9 -4
- data/spec/active_record_spec.rb +17 -0
- 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: ec6a0c9433686aa65ea4471267dbbc55b2499d6c
|
4
|
+
data.tar.gz: c4eb194ae78343644a62a32a058117405c0373d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2c87bd214134cdfb2fb22ea671831fdddcdce0be1b4825b8bb0def5b2ca0ccde375fa1eb5cb05c6226a6da4a7367e1172c73c19393dbeefb06bbd34f4e74b92
|
7
|
+
data.tar.gz: fe61a6cdbfa806d5163b461f0cb59c3035588247cfb68f8e6faaa26459ee9a03a517446b449f7d2733f19837307fa028659c2160bb40582fb1ed80baf7e25e93
|
data/lib/store/active_record.rb
CHANGED
@@ -63,7 +63,7 @@ class Store
|
|
63
63
|
cls.all
|
64
64
|
end
|
65
65
|
|
66
|
-
|
66
|
+
module StoredEntity
|
67
67
|
def uid
|
68
68
|
id.to_s
|
69
69
|
end
|
@@ -76,9 +76,14 @@ class Store
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def build_class
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
@cls = Class.new(::ActiveRecord::Base) do
|
80
|
+
include StoredEntity
|
81
|
+
end
|
82
|
+
|
83
|
+
@cls.table_name = @table_name
|
84
|
+
@cls.inheritance_column = 'sti_deactivated'
|
85
|
+
|
86
|
+
@cls
|
82
87
|
end
|
83
88
|
|
84
89
|
def cls
|
data/spec/active_record_spec.rb
CHANGED
@@ -23,7 +23,24 @@ describe Store::DataMapper::ActiveRecord do
|
|
23
23
|
assert_equal 'sti_deactivated', subject.send(:cls).inheritance_column
|
24
24
|
end
|
25
25
|
|
26
|
+
it 'sets table_name' do
|
27
|
+
assert_equal 'Bar', subject.send(:cls).table_name
|
28
|
+
end
|
29
|
+
|
26
30
|
run_subject_against_store_spec_gem
|
27
31
|
end
|
28
32
|
|
33
|
+
describe 'class' do
|
34
|
+
it 'should set individual table_names' do
|
35
|
+
mapper_class1 = Class.new(Store::DataMapper::ActiveRecord)
|
36
|
+
mapper_class2 = Class.new(Store::DataMapper::ActiveRecord)
|
37
|
+
|
38
|
+
mapper1 = mapper_class1.new('tbl1')
|
39
|
+
mapper2 = mapper_class2.new('tbl2')
|
40
|
+
|
41
|
+
assert_equal 'tbl1', mapper1.send(:cls).table_name
|
42
|
+
assert_equal 'tbl2', mapper2.send(:cls).table_name
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
29
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: store-active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Owiesniak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.0.
|
150
|
+
rubygems_version: 2.0.3
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: Basic ActiveRecord DataMapper for Store.
|