rectify 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rectify/command.rb +1 -1
- data/lib/rectify/form.rb +17 -2
- data/lib/rectify/query.rb +2 -2
- data/lib/rectify/rspec/stub_form.rb +2 -2
- data/lib/rectify/version.rb +1 -1
- data/readme.md +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67f7776f5c98dc7017150f2c7c361c62605dce6f
|
4
|
+
data.tar.gz: 6b8ab74b2a86b8f8ae72ded1ab299659337230e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8fb81cc7e16eb530ab307073735de1abb085a509f9278ef3dfe6da85c0f92ac58e1ee32260022c3b68fa3df9e2fe4c0e018adbc94b4d02c07f719c079ce1e77
|
7
|
+
data.tar.gz: 4b027533b746f6a90241a6029b2fb50b3bda07c6a419dea59191372d7c0fe43eb85d78a1c90be2a51c6f3f8cb64c5c45994a05f507d09b18ff5c14e9611b8859
|
data/lib/rectify/command.rb
CHANGED
data/lib/rectify/form.rb
CHANGED
@@ -10,12 +10,27 @@ module Rectify
|
|
10
10
|
|
11
11
|
attribute_names = attribute_set.map(&:name)
|
12
12
|
|
13
|
-
|
13
|
+
attributes_hash = params_hash
|
14
14
|
.fetch(mimicked_model_name, {})
|
15
15
|
.merge(params_hash.slice(*attribute_names))
|
16
16
|
.merge(additional_params)
|
17
17
|
|
18
|
-
|
18
|
+
convert_indexed_hashes_to_arrays(attributes_hash)
|
19
|
+
|
20
|
+
new(attributes_hash)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.convert_indexed_hashes_to_arrays(attributes_hash)
|
24
|
+
array_attribute_names.each do |name|
|
25
|
+
attribute = attributes_hash[name]
|
26
|
+
next unless attribute.is_a?(Hash)
|
27
|
+
|
28
|
+
attributes_hash[name] = attribute.values
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.array_attribute_names
|
33
|
+
attribute_set.select { |a| a.primitive == Array }.map { |a| a.name.to_s }
|
19
34
|
end
|
20
35
|
|
21
36
|
def self.from_model(model)
|
data/lib/rectify/query.rb
CHANGED
@@ -20,11 +20,11 @@ module Rectify
|
|
20
20
|
elsif eager? && other.eager?
|
21
21
|
Rectify::Query.new(cached_query | other.cached_query)
|
22
22
|
else
|
23
|
-
|
23
|
+
raise UnableToComposeQueries.new(self, other)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
|
27
|
+
alias merge |
|
28
28
|
|
29
29
|
def count
|
30
30
|
cached_query.count
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Rectify
|
2
2
|
class StubForm
|
3
|
-
attr_reader :attributes
|
3
|
+
attr_reader :attributes, :valid
|
4
4
|
|
5
5
|
def initialize(attributes)
|
6
6
|
@valid = attributes.fetch(:valid?, false)
|
@@ -8,7 +8,7 @@ module Rectify
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def valid?
|
11
|
-
|
11
|
+
valid
|
12
12
|
end
|
13
13
|
|
14
14
|
def invalid?
|
data/lib/rectify/version.rb
CHANGED
data/readme.md
CHANGED
@@ -233,7 +233,7 @@ You can use the constructor and pass it a hash of values:
|
|
233
233
|
form = UserForm.new(:first_name => "Andy", :last_name => "Pike")
|
234
234
|
```
|
235
235
|
|
236
|
-
**
|
236
|
+
**Params hash**
|
237
237
|
|
238
238
|
You can use the params hash that a Rails controller provides that contains all
|
239
239
|
the data in the request:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rectify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Pike
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virtus
|
@@ -28,14 +28,14 @@ dependencies:
|
|
28
28
|
name: wisper
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.6.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.6.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -44,56 +44,56 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.
|
47
|
+
version: 4.1.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.
|
54
|
+
version: 4.1.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activemodel
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 4.
|
61
|
+
version: 4.1.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 4.
|
68
|
+
version: 4.1.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activerecord
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 4.
|
75
|
+
version: 4.1.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 4.
|
82
|
+
version: 4.1.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: actionpack
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 4.
|
89
|
+
version: 4.1.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 4.
|
96
|
+
version: 4.1.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: awesome_print
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -227,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
227
227
|
version: '0'
|
228
228
|
requirements: []
|
229
229
|
rubyforge_project:
|
230
|
-
rubygems_version: 2.4.5
|
230
|
+
rubygems_version: 2.4.5.1
|
231
231
|
signing_key:
|
232
232
|
specification_version: 4
|
233
233
|
summary: Improvements for building Rails apps
|