diff options
author | Henare Degan <henare.degan@gmail.com> | 2013-01-25 15:17:21 +1100 |
---|---|---|
committer | Henare Degan <henare.degan@gmail.com> | 2013-01-25 15:24:27 +1100 |
commit | cb4510ee3c2f228ff08f5ba36a1935be1822a8d4 (patch) | |
tree | 4d1f8943ad7f3e536fe685985362b2458c3b1833 | |
parent | 8f07b5a2fba8cb3d354acbde8dabce403e1057fc (diff) |
AboutMeValidator model - Overwriting validate is deprecated in Rails 3
-rw-r--r-- | app/models/about_me_validator.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/about_me_validator.rb b/app/models/about_me_validator.rb index 5e04c2761..8ee505ac8 100644 --- a/app/models/about_me_validator.rb +++ b/app/models/about_me_validator.rb @@ -17,10 +17,14 @@ class AboutMeValidator < ActiveRecord::BaseWithoutTable column :about_me, :text, "I...", false - def validate + # TODO: Switch to built in validations + validate :length_of_about_me + + private + + def length_of_about_me if !self.about_me.blank? && self.about_me.size > 500 errors.add(:about_me, _("Please keep it shorter than 500 characters")) end end - end |