diff options
author | Henare Degan <henare.degan@gmail.com> | 2013-01-25 15:08:21 +1100 |
---|---|---|
committer | Henare Degan <henare.degan@gmail.com> | 2013-01-25 15:08:21 +1100 |
commit | 040ff038e139b8759cdec1a1ad7ece64956a51ec (patch) | |
tree | c83788615a0548910046bec028428255bcb99c36 | |
parent | 1f932b82dd4f3564f3173ab337e924c31b88717d (diff) |
ProfilePhoto model - Overwriting validate is deprecated in Rails 3
-rw-r--r-- | app/models/profile_photo.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/profile_photo.rb b/app/models/profile_photo.rb index 6e605651d..73d7ca12b 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 @@ -81,7 +83,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 |