From 1f5325e3f03db06aff71f1e1d9343ee2b7f21ed2 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 8 Sep 2016 12:03:38 -0400 Subject: [PATCH] FIX: Only validate uploaded URLs if they change --- app/models/category.rb | 4 ++-- app/models/user_profile.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/category.rb b/app/models/category.rb index f6925a42821..2d077cd6fb9 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -38,8 +38,8 @@ class Category < ActiveRecord::Base validate :email_in_validator - validates :logo_url, upload_url: true - validates :background_url, upload_url: true + validates :logo_url, upload_url: true, if: :logo_url_changed? + validates :background_url, upload_url: true, if: :background_url_changed? validate :ensure_slug before_save :apply_permissions diff --git a/app/models/user_profile.rb b/app/models/user_profile.rb index b6d97d0486a..092276dc250 100644 --- a/app/models/user_profile.rb +++ b/app/models/user_profile.rb @@ -9,8 +9,8 @@ class UserProfile < ActiveRecord::Base before_save :cook after_save :trigger_badges - validates :profile_background, upload_url: true - validates :card_background, upload_url: true + validates :profile_background, upload_url: true, if: :profile_background_changed? + validates :card_background, upload_url: true, if: :card_background_changed? belongs_to :card_image_badge, class_name: 'Badge' has_many :user_profile_views, dependent: :destroy