FIX: Only validate uploaded URLs if they change

This commit is contained in:
Robin Ward 2016-09-08 12:03:38 -04:00
parent ed0b355e15
commit 1f5325e3f0
2 changed files with 4 additions and 4 deletions

View File

@ -38,8 +38,8 @@ class Category < ActiveRecord::Base
validate :email_in_validator validate :email_in_validator
validates :logo_url, upload_url: true validates :logo_url, upload_url: true, if: :logo_url_changed?
validates :background_url, upload_url: true validates :background_url, upload_url: true, if: :background_url_changed?
validate :ensure_slug validate :ensure_slug
before_save :apply_permissions before_save :apply_permissions

View File

@ -9,8 +9,8 @@ class UserProfile < ActiveRecord::Base
before_save :cook before_save :cook
after_save :trigger_badges after_save :trigger_badges
validates :profile_background, upload_url: true validates :profile_background, upload_url: true, if: :profile_background_changed?
validates :card_background, upload_url: true validates :card_background, upload_url: true, if: :card_background_changed?
belongs_to :card_image_badge, class_name: 'Badge' belongs_to :card_image_badge, class_name: 'Badge'
has_many :user_profile_views, dependent: :destroy has_many :user_profile_views, dependent: :destroy