module Formalism::R18nErrors
Main module which should be included into base form
Constants
- VERSION
Attributes
errors[R]
errors_key[RW]
Public Class Methods
new(*)
click to toggle source
Calls superclass method
# File lib/formalism/r18n_errors.rb, line 11 def initialize(*) ## `@errors_key` should be set in using form @errors = Errors.new super end
Private Instance Methods
add_error(*args, **kwargs)
click to toggle source
# File lib/formalism/r18n_errors.rb, line 32 def add_error(*args, **kwargs) raise '`@errors_key` is required' unless errors_key errors.add errors_key, *args, **kwargs end
initialize_nested_form(name, options)
click to toggle source
Calls superclass method
# File lib/formalism/r18n_errors.rb, line 25 def initialize_nested_form(name, options) return unless (form = super) form.errors_key = options.fetch(:errors_key, name) form end
merge_errors_of_nested_form(name, nested_form)
click to toggle source
# File lib/formalism/r18n_errors.rb, line 38 def merge_errors_of_nested_form(name, nested_form) add_error name, nested_errors: nested_form.errors end
nested_form_to_params(_name_of_nested_form, nested_form)
click to toggle source
Calls superclass method
# File lib/formalism/r18n_errors.rb, line 42 def nested_form_to_params(_name_of_nested_form, nested_form) return super if nested_form.errors_key nested_form.to_params end