Skip to content

Commit

Permalink
Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
benlovell committed Feb 22, 2024
1 parent d59e150 commit ec2d70d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/dough/forms/builders/validation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@ module ValidationModule
include ActionView::Helpers::TranslationHelper

def validation_summary
ApplicationController.render(partial: 'dough/forms/builders/validation/summary_for_errors', locals: { errors: errors, error_prefix: error_prefix })
ApplicationController.render(
partial: 'dough/forms/builders/validation/summary_for_errors',
locals: { errors: errors, error_prefix: error_prefix }
)
end

def errors_for(subject = nil, field)
subject ||= object
filtered_errors = errors.select { |hash| hash[:object] == subject && hash[:field] == field }

ApplicationController.render(partial: 'dough/forms/builders/validation/errors_for_field', collection: filtered_errors, as: 'error', locals: { error_prefix: error_prefix })
ApplicationController.render(
partial: 'dough/forms/builders/validation/errors_for_field',
collection: filtered_errors,
as: 'error',
locals: { error_prefix: error_prefix }
)
end

def validates(*models)
Expand Down

0 comments on commit ec2d70d

Please sign in to comment.