FIX: Support Ruby 3 keyword arguments

This commit is contained in:
Yasuo Honda
2021-09-27 21:45:05 +09:00
committed by Robin Ward
parent 5569723321
commit dbbfad7ed0
12 changed files with 24 additions and 24 deletions

View File

@ -20,11 +20,11 @@ class PostValidator < ActiveModel::Validator
def presence(post)
unless options[:skip_topic]
post.errors.add(:topic_id, :blank, options) if post.topic_id.blank?
post.errors.add(:topic_id, :blank, **options) if post.topic_id.blank?
end
if post.new_record? && post.user_id.nil?
post.errors.add(:user_id, :blank, options)
post.errors.add(:user_id, :blank, **options)
end
end