aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/about_me_validator.rb
blob: 70778d911ca121504ac2f0a924fcc40c8ce5ee27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# models/about_me_validator.rb:
# Validates editing about me text on user profile pages.
#
# Copyright (c) 2010 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
# $Id: contact_validator.rb,v 1.32 2009-09-17 21:10:05 francis Exp $

class AboutMeValidator < ActiveRecord::BaseWithoutTable
    strip_attributes!

    column :about_me, :text, "I...", false

    def validate
        if !self.about_me.blank? && self.about_me.size > 500
            errors.add(:about_me, "^Please keep it shorter than 500 characters") 
        end
    end

end