aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/about_me_validator.rb
blob: 8465b07167d1869e9d0dca6b257aca9f196a86b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# -*- encoding : utf-8 -*-
# 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: hello@mysociety.org; WWW: http://www.mysociety.org/

class AboutMeValidator
    include ActiveModel::Validations

    attr_accessor :about_me

    validates_length_of :about_me, :maximum => 500, :message => _("Please keep it shorter than 500 characters")

    def initialize(attributes = {})
        attributes.each do |name, value|
            send("#{name}=", value)
        end
    end
end