Module: ApplicationForm
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/application_form.rb,
lib/application_form/version.rb,
lib/generators/application_form/form_generator.rb
Defined Under Namespace
Modules: ClassMethods, Generators, Included
Classes: Error
Constant Summary
collapse
- VERSION =
'0.5.4'
Instance Method Summary
collapse
Instance Method Details
#assign_attributes(attrs = {}) ⇒ Object
59
60
61
62
|
# File 'lib/application_form.rb', line 59
def assign_attributes(attrs = {})
permitted_attrs = permit_attrs(attrs)
super(permitted_attrs)
end
|
#assign_attrs(attributes) ⇒ Object
80
81
82
83
|
# File 'lib/application_form.rb', line 80
def assign_attrs(attributes)
assign_attributes(attributes)
self
end
|
#checks_passed? ⇒ Boolean
72
73
74
|
# File 'lib/application_form.rb', line 72
def checks_passed?
valid?
end
|
#first_error_message ⇒ Object
68
69
70
|
# File 'lib/application_form.rb', line 68
def first_error_message
errors&.full_messages&.first
end
|
#first_failed_check ⇒ Object
76
77
78
|
# File 'lib/application_form.rb', line 76
def first_failed_check
errors.details[:base].first[:error].to_s
end
|
#permit_attrs(attrs) ⇒ Object
64
65
66
|
# File 'lib/application_form.rb', line 64
def permit_attrs(attrs)
attrs.respond_to?(:permit) ? attrs.send(:permit, self.class._permitted_args) : attrs
end
|
#update(attrs = {}) ⇒ Object
49
50
51
52
|
# File 'lib/application_form.rb', line 49
def update(attrs = {})
permitted_attrs = permit_attrs(attrs)
super(permitted_attrs)
end
|
#update!(attrs = {}) ⇒ Object
54
55
56
57
|
# File 'lib/application_form.rb', line 54
def update!(attrs = {})
permitted_attrs = permit_attrs(attrs)
super(permitted_attrs)
end
|