formwandler 0.8.0 → 0.8.1

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: d83c20395db6d499d42e57b1575f9c3020392221358d7ff1f7c825e667dc6ef5
4
- data.tar.gz: 315035887242f76e2f51336f09b58bb376b597932a505c539d4b0da8fdfb8b58
3
+ metadata.gz: 66346495ce82162b0731fb3263fa8977dd8f55e80c1e1f919fa7014b5b612e9c
4
+ data.tar.gz: 40056efd340d347534d994208c7d3a01940321f77df11796e0f9c9a7f61d582a
5
5
  SHA512:
6
- metadata.gz: e406427a31ea2cdf5cc8059ff9854e596831bd0ffc0cd9cdd128791ec4624213c3903cb98b403d90bbc88ca147b3bfe21087237c1f11f9fb8ef60b14f378a9b6
7
- data.tar.gz: 0216f9859f581c28439d671b90935a0158a2b31e487aa008c92673f2c30a1dcd153af047afebd0485baf97b15e9dff054f582787e179d6ec3b5168f380a69642
6
+ metadata.gz: 1e8f616e7ffeee9c4c709d041f804acb39c90a749c302b705350728f9786bcbf5f67d4ecf783c53fb6907be9d176ba8977479ae1590ee8cac272ffd6468cfba6
7
+ data.tar.gz: 28dc8f68e34baf128ff272c02e9bdd84c01aabddec4d4d8a32c1923f00becc2037201ec8d66aa3d350ee75bbcf682909ba2b1ebba64672c533a01ea3e3d0d03f
@@ -6,22 +6,18 @@ module Formwandler
6
6
 
7
7
  class_methods do
8
8
  def load_form(opts = {})
9
- before_action :_formwandler_load_form, opts
10
- end
11
-
12
- def skip_load_form(opts = {})
13
- skip_before_action :_formwandler_load_form, opts
9
+ before_action(opts.except(:models)) do
10
+ if opts.fetch(:models, true)
11
+ models = {inferred_resource_name.to_sym => instance_variable_get("@#{inferred_resource_name}")}.compact
12
+ end
13
+ form_instance = form_class.new(models: models || {}, controller: self)
14
+ instance_variable_set("@#{form_instance_name}", form_instance)
15
+ end
14
16
  end
15
17
  end
16
18
 
17
19
  private
18
20
 
19
- def _formwandler_load_form
20
- models = {inferred_resource_name.to_sym => instance_variable_get("@#{inferred_resource_name}")}.compact
21
- form_instance = form_class.new(models: models, controller: self)
22
- instance_variable_set("@#{form_instance_name}", form_instance)
23
- end
24
-
25
21
  def form_class_name
26
22
  "#{namespace}::#{inferred_resource_name.camelize}Form"
27
23
  end
@@ -1,3 +1,3 @@
1
1
  module Formwandler
2
- VERSION = '0.8.0'
2
+ VERSION = '0.8.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formwandler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Bilharz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-08 00:00:00.000000000 Z
11
+ date: 2019-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  - !ruby/object:Gem::Version
143
143
  version: '0'
144
144
  requirements: []
145
- rubygems_version: 3.0.1
145
+ rubygems_version: 3.0.3
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: Form objects for rails