rectify 0.4.3 → 0.4.4

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: d2a0e7f7f2fde27ccddf17c0bee4230d2ee8822a
4
- data.tar.gz: 64cf90ce06007d0493e2d73bb749edf63a02b558
3
+ metadata.gz: d17170c50a6d7e85611f9cc82503946e5bbf5fbc
4
+ data.tar.gz: 62f958cbf21a255a949f7e69f03e0b6c9e2457c3
5
5
  SHA512:
6
- metadata.gz: c862f1d56e2918a487a3eef2eab371523eef1cde1f3f87106d6229d33646639dcdde8d874ca4c7ec995a99075349901a7599a094560726217c12909dbba2d4fa
7
- data.tar.gz: 8dbb57c46fb7d37a44c4132323271fbbccd4f8d9e994b1933454fac3aebbf262fed18dc25c20418caff9bd142302ee858beccb170b0c5cdc95984be5f6f99030
6
+ metadata.gz: ee90509aa99f4b2b56ef755ca8cfd9f971b2af056da4af1b91cf67c8daa35e94a0e72a23877fccc26fb6a24091b9f4f00441bd9c07f5baf5606a6d8a2a7f0220
7
+ data.tar.gz: 05746e98f92c12066c5922f4f46782b8f6898062de952d93fbbbc77c528fd03f46d334a8656a44adfe180fa2a77a5fa038cb280aa725041302a59a93d5397d1b
data/lib/rectify/form.rb CHANGED
@@ -6,13 +6,16 @@ module Rectify
6
6
  attribute :id, Integer
7
7
 
8
8
  def self.from_params(params, additional_params = {})
9
- attributes = hash_from(params)
9
+ params_hash = hash_from(params)
10
+
11
+ attribute_names = attribute_set.map(&:name)
12
+
13
+ attributes = params_hash
10
14
  .fetch(mimicked_model_name, {})
15
+ .merge(params_hash.slice(*attribute_names))
11
16
  .merge(additional_params)
12
17
 
13
- new(attributes).tap do |f|
14
- f.id = params[:id]
15
- end
18
+ new(attributes)
16
19
  end
17
20
 
18
21
  def self.from_model(model)
@@ -1,3 +1,3 @@
1
1
  module Rectify
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
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.4.3
4
+ version: 0.4.4
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-05-03 00:00:00.000000000 Z
11
+ date: 2016-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus