diff options
-rw-r--r-- | app/models/public_body.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb index e05efc77e..8ce75c71c 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -23,7 +23,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: public_body.rb,v 1.103 2008-09-02 17:44:14 francis Exp $ +# $Id: public_body.rb,v 1.104 2008-09-07 17:01:49 francis Exp $ require 'csv' require 'set' @@ -110,6 +110,13 @@ class PublicBody < ActiveRecord::Base Hash[*self.categories_with_description.map() { |a| [a[0],a[2]] }.flatten] end + # Strip whitespace for everything, see http://railsforum.com/viewtopic.php?id=969 + before_save(:clean_whitespace) + def clean_whitespace + self.name = self.name.strip + self.short_name = self.short_name.strip + end + def validate # Request_email can be blank, meaning we don't have details |