formify 0.12.2 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/formify/form.rb +18 -1
- data/lib/formify/version.rb +1 -1
- data/lib/generators/form/templates/form.rb.tt +3 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe71eec837e180dbca7f7d146817af141983654b51408a8103252f02edae847e
|
4
|
+
data.tar.gz: 1386c4cb5e00795591b516cb2e8ec95ec6c8db76c7a8646294db82848889beb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c0cd5c592eddee0658f0fcb99b91a5d77aeda7cc179cfec3289c6325571d1b640c5b964afc96d3016c8d9e0fa4aefc8b5fde731db510ffe452abb9945b96d0d
|
7
|
+
data.tar.gz: aca56e783c4ee7382150797edf831161ba874df1ad5913747329526dae572d26956422cbb4a2c4d039a1b0cf8d3cb14a62630752b14131c93e519ef87f72e7c1
|
data/Gemfile.lock
CHANGED
data/lib/formify/form.rb
CHANGED
@@ -4,6 +4,24 @@ module Formify
|
|
4
4
|
module Form
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
|
+
module ClassMethods
|
8
|
+
def initialize_with(*args, &block)
|
9
|
+
define_method(:initialize) do |attributes = {}|
|
10
|
+
args.each do |arg|
|
11
|
+
instance_variable_set("@#{arg}", attributes[arg])
|
12
|
+
end
|
13
|
+
|
14
|
+
instance_exec(attributes, &block) if block_given?
|
15
|
+
|
16
|
+
super(attributes)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.included(base)
|
22
|
+
base.extend ClassMethods
|
23
|
+
end
|
24
|
+
|
7
25
|
included do
|
8
26
|
include ActiveModel::Model
|
9
27
|
define_model_callbacks :save
|
@@ -11,7 +29,6 @@ module Formify
|
|
11
29
|
include ActiveModel::Validations
|
12
30
|
include ActiveModel::Validations::Callbacks
|
13
31
|
|
14
|
-
|
15
32
|
def failure(*args)
|
16
33
|
Resonad.Failure(*args)
|
17
34
|
end
|
data/lib/formify/version.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
class <%= name.split('/').last.to_s.camelcase %>
|
5
5
|
include Formify::Form
|
6
6
|
|
7
|
-
# attr_accessor :
|
7
|
+
# attr_accessor :fixed_attr
|
8
8
|
|
9
9
|
# delegate_accessor :bar
|
10
10
|
# :baz,
|
@@ -16,11 +16,8 @@ class <%= name.split('/').last.to_s.camelcase %>
|
|
16
16
|
|
17
17
|
# validate :validate_
|
18
18
|
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
# self.fixed_attr = attributes[:fixed_attr]
|
23
|
-
# super(attributes)
|
19
|
+
# initialize_with :fixed_attr do |attributes|
|
20
|
+
# puts attributes
|
24
21
|
# end
|
25
22
|
|
26
23
|
def save
|