store-active_record 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{.travis.yaml → .travis.yml} +0 -0
- data/README.md +4 -0
- data/config/database.yml.sample +2 -2
- data/lib/store/active_record/version.rb +1 -1
- data/lib/store/active_record.rb +8 -4
- data/spec/active_record_spec.rb +1 -1
- 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: ced45712e34f5adc309c520e1eba87e0e81f8163
|
4
|
+
data.tar.gz: 6f53ae15b28c2185ecb97b06d5d61567da1131ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f955103252120301a4f78679be3d5139028c9eb13814360c06069cf9dc0bac5b3a4806f958d6fe24bc64d958d5109f6903753570fcad0a115798797f9b98b32
|
7
|
+
data.tar.gz: 6c03f111256cc5a7a6bb72b89c097424fe259ac487ee7f00810adf48d5bf930ac4384abdd9d66fb80ae14956bbf39aa94e7914ef288e5935fe0b44e4e4ee2853
|
File without changes
|
data/README.md
CHANGED
data/config/database.yml.sample
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
development:
|
2
|
-
adapter:
|
2
|
+
adapter: sqlite3
|
3
3
|
encoding: utf8
|
4
4
|
collation: utf8_general_ci
|
5
5
|
reconnect: false
|
6
6
|
database: store_active_record
|
7
7
|
|
8
8
|
test:
|
9
|
-
adapter:
|
9
|
+
adapter: sqlite3
|
10
10
|
encoding: utf8
|
11
11
|
collation: utf8_general_ci
|
12
12
|
reconnect: false
|
data/lib/store/active_record.rb
CHANGED
@@ -14,7 +14,7 @@ class Store
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def insert(data)
|
17
|
-
entity =
|
17
|
+
entity = cls.create(data)
|
18
18
|
entity.id.to_s
|
19
19
|
end
|
20
20
|
|
@@ -35,7 +35,7 @@ class Store
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def bulk_find(ids)
|
38
|
-
entities =
|
38
|
+
entities = cls.where(:id => ids).to_a
|
39
39
|
ordered_entities = ids.map do |id|
|
40
40
|
entities.detect {|entity| entity.id == id.to_i }
|
41
41
|
end
|
@@ -43,7 +43,7 @@ class Store
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def count
|
46
|
-
|
46
|
+
cls.count
|
47
47
|
end
|
48
48
|
|
49
49
|
private
|
@@ -62,6 +62,10 @@ class Store
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
+
def cls
|
66
|
+
@cls
|
67
|
+
end
|
68
|
+
|
65
69
|
def establish_connection
|
66
70
|
base.establish_connection(@spec)
|
67
71
|
end
|
@@ -71,7 +75,7 @@ class Store
|
|
71
75
|
end
|
72
76
|
|
73
77
|
def find_by_id(id)
|
74
|
-
|
78
|
+
cls.find_by_id(id)
|
75
79
|
end
|
76
80
|
|
77
81
|
end
|
data/spec/active_record_spec.rb
CHANGED
@@ -17,7 +17,7 @@ def create_test_table(table, spec)
|
|
17
17
|
end
|
18
18
|
|
19
19
|
describe Store::DataMapper::ActiveRecord do
|
20
|
-
spec = YAML.load_file("#{File.dirname(__FILE__)}/../config/database.yml")['test']
|
20
|
+
spec = YAML.load_file("#{File.dirname(__FILE__)}/../config/database.yml.sample")['test']
|
21
21
|
table = 'Bar'
|
22
22
|
|
23
23
|
create_test_table(table, spec)
|
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.2
|
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-08-
|
11
|
+
date: 2013-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -117,7 +117,7 @@ extra_rdoc_files: []
|
|
117
117
|
files:
|
118
118
|
- .gitignore
|
119
119
|
- .rvmrc
|
120
|
-
- .travis.
|
120
|
+
- .travis.yml
|
121
121
|
- Gemfile
|
122
122
|
- LICENSE.txt
|
123
123
|
- README.md
|