active_house 0.1.2 → 0.1.3
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/active_house/collectable.rb +1 -1
- data/lib/active_house/modeling.rb +18 -2
- data/lib/active_house/query.rb +1 -1
- data/lib/active_house/scopeable.rb +2 -1
- data/lib/active_house/scoping.rb +2 -2
- data/lib/active_house/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1881c335facd03315b054272bda63feb0dad94bc
|
4
|
+
data.tar.gz: 3ff3163f387c26d522c21ada86e53e428af96e6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c3855225c06b94397b6ab83ccd9eb016a49db843a423e0ccd8205c8c88a9eb41a55e56d952e68b34651ae6de5aa7eeb45244945eb95014e136b083900631e62
|
7
|
+
data.tar.gz: f95934da0a72bc53c9a95d026ae33a476eacc7718653585f44c83d5d7634a1dd125b6bd6a682c49094c207b20b7c2aa74abb6679cbc2cc7160cb0fd0394c1212
|
@@ -18,7 +18,7 @@ module ActiveHouse
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def attribute_method?(name, is_setter, *args)
|
21
|
-
(_attribute_opts.key?(name) || @_attributes.key?(name)) && (is_setter ? args.size
|
21
|
+
(_attribute_opts.key?(name) || @_attributes.key?(name)) && (is_setter ? args.size == 1 : true)
|
22
22
|
end
|
23
23
|
|
24
24
|
def get_attribute(name)
|
@@ -40,11 +40,17 @@ module ActiveHouse
|
|
40
40
|
options = names.extract_options!
|
41
41
|
names.each { |name| attributes(name, options.dup) }
|
42
42
|
end
|
43
|
+
|
44
|
+
def load!(params)
|
45
|
+
new.tap do |model|
|
46
|
+
params.each { |name, value| model[name] = value }
|
47
|
+
end
|
48
|
+
end
|
43
49
|
end
|
44
50
|
|
45
51
|
def initialize(params = {})
|
46
52
|
@_attributes = {}
|
47
|
-
assign_attributes(params)
|
53
|
+
assign_attributes(params) unless params.nil?
|
48
54
|
end
|
49
55
|
|
50
56
|
def as_json(*_args)
|
@@ -59,6 +65,16 @@ module ActiveHouse
|
|
59
65
|
@_attributes[key.to_sym]
|
60
66
|
end
|
61
67
|
|
68
|
+
def []=(key, value)
|
69
|
+
@_attributes[key.to_sym] = value
|
70
|
+
end
|
71
|
+
|
72
|
+
def assign_attributes(params)
|
73
|
+
params.each do |key, val|
|
74
|
+
public_send("#{key}=", val)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
62
78
|
def respond_to_missing?(method_name, *args)
|
63
79
|
name, is_setter = parse_attribute_method_name(method_name)
|
64
80
|
attribute_method?(name, is_setter, *args)
|
data/lib/active_house/query.rb
CHANGED
data/lib/active_house/scoping.rb
CHANGED
data/lib/active_house/version.rb
CHANGED