ar_doc_store 2.0.1 → 2.0.2
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/model.rb +1 -1
- data/lib/ar_doc_store/storage.rb +2 -2
- data/lib/ar_doc_store/version.rb +1 -1
- data/test/attributes/string_attribute_test.rb +5 -0
- data/test/test_helper.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb15be10e81091e7b3097de1f850c17c35441c48a474aa2b4429e816d8090c07
|
4
|
+
data.tar.gz: 254d183d092b733d0eaab89792266940221c5b6aa4e06c930f7544edf63d8e3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3f6fa036da43c10a0b1a0f9b260f31aa344b537c03dea053d52389abc257ef267ce2bb7eea9ac677cc042597d8c0f55612e5e8725b07a03ed1f124c8cf3c7ee
|
7
|
+
data.tar.gz: faa156db5a2cddc18756eba7edf9f011e8476fabe22651017dda706201be812a33cd5e394aa72a20f361dcc010651e1b94a412e4a3bce4429e7bd07b5ce7170e
|
data/lib/ar_doc_store/model.rb
CHANGED
@@ -10,7 +10,7 @@ module ArDocStore
|
|
10
10
|
|
11
11
|
module InstanceMethods
|
12
12
|
def assign_json_data
|
13
|
-
json_data = self[json_column]
|
13
|
+
json_data = respond_to?(json_column) && self[json_column]
|
14
14
|
return if json_data.blank?
|
15
15
|
json_attributes.keys.each do |key|
|
16
16
|
next unless json_data.key?(key)
|
data/lib/ar_doc_store/storage.rb
CHANGED
@@ -24,8 +24,8 @@ module ArDocStore
|
|
24
24
|
def add_ransacker(key, predicate = nil)
|
25
25
|
return unless respond_to?(:ransacker)
|
26
26
|
ransacker key do |parent|
|
27
|
-
sql = "(#{parent.table[
|
28
|
-
if predicate
|
27
|
+
sql = "(#{parent.table[json_column].name}->>'#{key}')"
|
28
|
+
if predicate.present?
|
29
29
|
sql = "#{sql}::#{predicate}"
|
30
30
|
end
|
31
31
|
Arel.sql(sql)
|
data/lib/ar_doc_store/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -9,7 +9,7 @@ ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: 'ar_doc
|
|
9
9
|
|
10
10
|
require 'active_record/migration'
|
11
11
|
|
12
|
-
ActiveRecord::Migration.execute "DROP TABLE IF EXISTS purchase_orders"
|
12
|
+
ActiveRecord::Migration[4.2].execute "DROP TABLE IF EXISTS purchase_orders"
|
13
13
|
ActiveRecord::Migration.execute "DROP TABLE IF EXISTS buildings"
|
14
14
|
ActiveRecord::Migration.create_table :buildings do |t|
|
15
15
|
t.jsonb :data
|
@@ -33,7 +33,7 @@ end
|
|
33
33
|
|
34
34
|
class Door
|
35
35
|
include ArDocStore::EmbeddableModel
|
36
|
-
|
36
|
+
json_attribute :door_type, as: :enumeration, multiple: true, values: %w{single double french sliding push pull}
|
37
37
|
json_attribute :open_handle, as: :enumeration, multiple: true, values: %w{push pull plate knob handle}
|
38
38
|
json_attribute :close_handle, as: :enumeration, multiple: true, values: %w{push pull plate knob handle}
|
39
39
|
json_attribute :clear_distance, as: :integer
|
@@ -69,6 +69,7 @@ class Building < ActiveRecord::Base
|
|
69
69
|
json_attribute :inspected_at, as: :datetime
|
70
70
|
json_attribute :finished_on, as: :date
|
71
71
|
json_attribute :cost, as: :decimal
|
72
|
+
json_attribute :html
|
72
73
|
embeds_one :entrance
|
73
74
|
embeds_one :main_entrance, class_name: 'Entrance'
|
74
75
|
embeds_many :restrooms
|
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: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Furber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|