diff --git a/lib/chartkick/helper.rb b/lib/chartkick/helper.rb index 9f16bec..fb7a25d 100644 --- a/lib/chartkick/helper.rb +++ b/lib/chartkick/helper.rb @@ -78,7 +78,7 @@ def chartkick_chart(klass, data_source, **options) # limit to alphanumeric and % for simplicity # this prevents things like calc() but safety is the priority # dot does not need escaped in square brackets - raise ArgumentError, "Invalid #{k}" unless html_vars[k] =~ /\A[a-zA-Z0-9%.]*\z/ + raise ArgumentError, "Invalid #{k}" unless /\A[a-zA-Z0-9%.]*\z/.match?(html_vars[k]) end html_vars.each_key do |k|