Skip to content

Commit

Permalink
Make error_class work on inner wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
coupling committed Mar 3, 2021
1 parent 886713c commit 111e476
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/simple_form/wrappers/many.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def initialize(namespace, components, defaults = {})
@defaults = defaults
@defaults[:tag] = :div unless @defaults.key?(:tag)
@defaults[:class] = Array(@defaults[:class])
@defaults[:error_class] = Array(@defaults[:error_class])
end

def render(input)
Expand Down Expand Up @@ -67,7 +68,10 @@ def html_options(options)
end

def html_classes(input, options)
@defaults[:class].dup
classes = []
classes << @defaults[:class].dup
classes << @defaults[:error_class].dup if input.has_errors?
classes
end
end
end
Expand Down

0 comments on commit 111e476

Please sign in to comment.