Rails 5.x compatible Tag value method signature

This commit is contained in:
Adam Meehan 2018-05-16 09:06:36 +10:00
parent 84b1885b6b
commit 4fef42ac24

View File

@ -16,7 +16,8 @@ module ValidatesTimeliness
@template_object, @options, @html_options = template_object, options, html_options
end
def value(object)
# Splat args to support Rails 5.0 which expects object, and 5.2 which doesn't
def value(*object)
return super unless @template_object.params[@object_name]
pairs = @template_object.params[@object_name].select {|k,v| k =~ /^#{@method_name}\(/ }