active_form_objects 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c1b13583aed6b595d8dded34bbab6c0eb0453880b1689b36f6c83b2c42864fd
4
- data.tar.gz: 173f5611e40785b68f19f3b0969b34a40580110b7dfac3d8a83a7c959c4b2b2d
3
+ metadata.gz: 7309d6b773941debdd36cea75f51b5b1283b0d6ce68a405c871a330ff66fae94
4
+ data.tar.gz: f7b7ba2844b0275e699b9d61b30aa735c018e69283a9d3554469711b0e1e1f6c
5
5
  SHA512:
6
- metadata.gz: c222d8eea18ff97532ef450482f1ed7411e33fec22910a2fc4b1223d2081b296eec2dfb085fbdf90181bc60e54a96bb70eb41f30d5d38b81a62e1fc03fd7a872
7
- data.tar.gz: 3b50cf192e75592de311794b73af4ec7102ed32d6f68df27410dd14ee797f56ebb747e94a52737d121371d7653a1fbaee8c933a15a2a3f5dad4ca7d5f00aa272
6
+ metadata.gz: 66e6e119ad7709506ddbd1b0dfb7829a3b5ef9569c1314f8d596767b46a3a580f3d1491ec93a739c45b5cab596754aa284e124925e6300c7047afc6d9b3d1de9
7
+ data.tar.gz: '0294103c0731a28629de35e9a7b727e17b7e84ef6ec5fa6577b4ba34563209d5d632c519a769c7b02186208a0bce5d846912a8e20aa4cde6bd7d608820606353'
@@ -54,6 +54,12 @@ module Dsl
54
54
  key: params.first,
55
55
  lambda: lambda_to_call
56
56
  }]
57
+ send(:attributes, params.first)
58
+ end
59
+
60
+ def self.validates(*params)
61
+ send(:attributes, *params[0...-1])
62
+ super(*params)
57
63
  end
58
64
  end
59
65
  end
@@ -6,7 +6,15 @@ module Handlers
6
6
  class_resource = upper(:@@resource)
7
7
  @resource ||= class_resource.try(:call, @params).try(:new)
8
8
 
9
+ attempt_resource_autoset
10
+
9
11
  @klass.instance_variable_set(:@resource, @resource)
10
12
  end
13
+
14
+ def attempt_resource_autoset
15
+ class_name = @klass.class.name.split('Form')[0].constantize if @klass.class.name.include?('Form')
16
+ @resource ||= class_name.instance_of?(Class) ? class_name.new : nil
17
+ rescue
18
+ end
11
19
  end
12
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_form_objects
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michaël Villeneuve
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-25 00:00:00.000000000 Z
11
+ date: 2019-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport