on_form 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3954acd09fbf4ca235b6b1f7e772f976569d33e9
4
- data.tar.gz: 7daa8aad9e92b30e366e916129d8b38f4315e808
3
+ metadata.gz: fc9552629f219a60bdb440b73aeaff5bab8ee8a7
4
+ data.tar.gz: 30fe72e471a35b622fd9203899b175a554f85785
5
5
  SHA512:
6
- metadata.gz: 7bd90546fd6e5ed2f3db683203cab7dcf2bc9a472ee2e9dac7a56cd306ea47df02742521f9b92f5a778b482a6334954f739edb0dc1f6dbde82ff1fd62c0fa466
7
- data.tar.gz: 67efe21b5c8fd2ecf6ea3ab245d3ab2e7720d7639903b247559c88de412d5b86c4d958a1fcc888aba697605856216d89dcd7d5015efb44084f011ea5c679f713
6
+ metadata.gz: 31cae4ebd42811962196cc71da3e0b44d549a30d906b4be52cf88f6dfc6342d24bcbeab9971b91025a799732786a427dfbbc4566be1e84643cc1771be6f1718e
7
+ data.tar.gz: 1336b1e8f6d98778ab2d836dbbfba0986f3a76e7641676386443a4b1d71f667c015537d602d97964af57857b943976961a2364b0f794ed3cdbdf73c948401941
data/CHANGES.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 2.2.2
5
+ -----
6
+ * Support non-array argument to `expose`.
7
+ * Fix compatibility with `ActionController::Parameters`.
8
+
4
9
  2.2.1
5
10
  -----
6
11
  * Fill in the validation error message for Rails 4.2.
@@ -32,7 +32,9 @@ module OnForm
32
32
 
33
33
  def attributes=(attributes)
34
34
  # match ActiveRecord #attributes= behavior on nil, scalars, etc.
35
- raise ArgumentError, "When assigning attributes, you must pass a hash as an argument." unless attributes.is_a?(Hash)
35
+ if !attributes.respond_to?(:stringify_keys)
36
+ raise ArgumentError, "When assigning attributes, you must pass a hash as an argument."
37
+ end
36
38
 
37
39
  multiparameter_attributes = {}
38
40
  attributes.each do |attribute_name, attribute_value|
data/lib/on_form/form.rb CHANGED
@@ -24,6 +24,7 @@ module OnForm
24
24
  end
25
25
 
26
26
  def self.expose(backing_attribute_names, on:, prefix: nil, suffix: nil, as: nil)
27
+ backing_attribute_names = Array(backing_attribute_names)
27
28
  raise ArgumentError, "can't expose multiple attributes as the same form attribute!" if as && backing_attribute_names.size != 1
28
29
  on = on.to_sym
29
30
  expose_backing_model(on)
@@ -1,3 +1,3 @@
1
1
  module OnForm
2
- VERSION = "2.2.1"
2
+ VERSION = "2.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: on_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Bryant
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-29 00:00:00.000000000 Z
11
+ date: 2016-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel