aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/profile_photo.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/models/profile_photo.rb b/app/models/profile_photo.rb
index e6562b904..41cb298b3 100644
--- a/app/models/profile_photo.rb
+++ b/app/models/profile_photo.rb
@@ -23,6 +23,8 @@ class ProfilePhoto < ActiveRecord::Base
belongs_to :user
+ validate :data_and_draft_checks
+
# deliberately don't strip_attributes, so keeps raw photo properly
attr_accessor :x, :y, :w, :h
@@ -65,7 +67,9 @@ class ProfilePhoto < ActiveRecord::Base
end
end
- def validate
+ private
+
+ def data_and_draft_checks
if self.data.nil?
errors.add(:data, N_("Please choose a file containing your photo."))
return
@@ -93,8 +97,6 @@ class ProfilePhoto < ActiveRecord::Base
end
end
- private
-
# Convert binary data blob into ImageMagick image when assigned
def convert_data_to_image
if data.nil?