ar_doc_store 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ar_doc_store/attribute_types/array.rb +4 -0
- data/lib/ar_doc_store/attribute_types/base.rb +1 -9
- data/lib/ar_doc_store/attribute_types/boolean.rb +2 -2
- data/lib/ar_doc_store/attribute_types/enumeration.rb +4 -0
- data/lib/ar_doc_store/attribute_types/float.rb +2 -2
- data/lib/ar_doc_store/attribute_types/integer.rb +2 -2
- data/lib/ar_doc_store/embedding/embeds_many.rb +1 -1
- data/lib/ar_doc_store/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f53b88c6de1ed3b89140686a6322e0e657019fb4
|
4
|
+
data.tar.gz: 27633939568dfd0e2534e7c7fbd588fd8fec4521
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c7f66c471005f5ad2777203e864019452c855018010becb66300aa2c0c6f6ed065785362fae8da98f96fe4a7e9c829e74a93d0732cd23d608d5d1b97a4426b7
|
7
|
+
data.tar.gz: 1c7540f9d60c030368a27d253cacca11ee8ac2187acefa43404de7f4a0bb3ef8c12952fcb2e73dae9f71075bb6ab876e5452aa4db5f1692eb2edbbb7daab7c02
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ArDocStore
|
2
2
|
module AttributeTypes
|
3
3
|
class Base
|
4
|
-
attr_accessor :conversion, :predicate, :options, :model, :attribute
|
4
|
+
attr_accessor :conversion, :predicate, :options, :model, :attribute, :default
|
5
5
|
|
6
6
|
def self.build(model, attribute, options={})
|
7
7
|
new(model, attribute, options).build
|
@@ -9,20 +9,12 @@ module ArDocStore
|
|
9
9
|
|
10
10
|
def initialize(model, attribute, options)
|
11
11
|
@model, @attribute, @options = model, attribute, options
|
12
|
-
add_to_columns_hash
|
13
12
|
end
|
14
13
|
|
15
14
|
def build
|
16
15
|
model.store_attributes conversion, predicate, attribute
|
17
16
|
end
|
18
17
|
|
19
|
-
def add_to_columns_hash
|
20
|
-
model.columns_hash[attribute.to_s] = ActiveRecord::ConnectionAdapters::PostgreSQLColumn.new(attribute, nil, column_type)
|
21
|
-
end
|
22
|
-
|
23
|
-
def column_type
|
24
|
-
ActiveRecord::Type::String.new
|
25
|
-
end
|
26
18
|
end
|
27
19
|
|
28
20
|
end
|
@@ -45,7 +45,7 @@ module ArDocStore
|
|
45
45
|
items
|
46
46
|
}
|
47
47
|
define_method "#{assn_name}=".to_sym, -> (values) {
|
48
|
-
if values
|
48
|
+
if values && values.respond_to?(:map)
|
49
49
|
items = values.map { |item|
|
50
50
|
my_class_name = class_name.constantize
|
51
51
|
item.is_a?(my_class_name) ? item : my_class_name.new(item)
|
data/lib/ar_doc_store/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar_doc_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Furber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|