Fix new rubocop warnings

This commit is contained in:
Tom Hughes 2020-11-17 08:17:34 +00:00
parent 8d2fbc63a4
commit 2ecfd61ee9
2 changed files with 3 additions and 3 deletions

View file

@ -3,7 +3,7 @@ class CharactersValidator < ActiveModel::EachValidator
INVALID_URL_CHARS = "/;.,?%#".freeze
def validate_each(record, attribute, value)
record.errors[attribute] << (options[:message] || I18n.t("validations.invalid_characters")) if /[#{INVALID_CHARS}]/.match?(value)
record.errors[attribute] << (options[:message] || I18n.t("validations.url_characters", :characters => INVALID_URL_CHARS)) if options[:url_safe] && /[#{INVALID_URL_CHARS}]/.match?(value)
record.errors[attribute] << (options[:message] || I18n.t("validations.invalid_characters")) if /[#{INVALID_CHARS}]/o.match?(value)
record.errors[attribute] << (options[:message] || I18n.t("validations.url_characters", :characters => INVALID_URL_CHARS)) if options[:url_safe] && /[#{INVALID_URL_CHARS}]/o.match?(value)
end
end

View file

@ -37,7 +37,7 @@ module GPX
end
def points(&block)
return enum_for(:points) unless block_given?
return enum_for(:points) unless block
@possible_points = 0
@actual_points = 0