Remove duplication in code to validate video URL

We were using the same code, and the same regular expressions, in two
places. To do so, we were including a helper inside a model, which is
something we don't usually do.
This commit is contained in:
Javi Martín
2024-05-19 04:25:26 +02:00
parent 250fdd2335
commit 236b58ab01
4 changed files with 32 additions and 28 deletions

View File

@@ -14,7 +14,7 @@ class Proposal < ApplicationRecord
include Mappable
include Notifiable
include Documentable
include EmbedVideosHelper
include Videoable
include Relationable
include Milestoneable
include Randomizable
@@ -59,8 +59,6 @@ class Proposal < ApplicationRecord
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
validate :valid_video_url?
before_validation :set_responsible_name
before_save :calculate_hot_score, :calculate_confidence_score