diff options
author | Henare Degan <henare.degan@gmail.com> | 2012-12-12 14:02:11 +1100 |
---|---|---|
committer | Henare Degan <henare.degan@gmail.com> | 2012-12-12 15:28:15 +1100 |
commit | 1beb9b6abea59a231b1799283d9a59388d9a7659 (patch) | |
tree | 93a4823c6a2efa0b3ab68e4f2700ae1e5328e6d3 | |
parent | 2207e3ccdec62e634189f811193fb605c4750b82 (diff) |
Overwriting validate in your models has been deprecated
User model specs now pass with no deprecation warnings
-rw-r--r-- | app/models/profile_photo.rb | 8 |
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? |