diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/public_body.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 5f89878ef..a372de435 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -29,6 +29,7 @@ # $Id: public_body.rb,v 1.160 2009-10-02 22:56:35 francis Exp $ require 'csv' +require 'securerandom' require 'set' class PublicBody < ActiveRecord::Base @@ -88,10 +89,13 @@ class PublicBody < ActiveRecord::Base end end - # Make sure publication_scheme gets the correct default value. - # (This would work automatically, were publication_scheme not a translated attribute) def after_initialize + # Make sure publication_scheme gets the correct default value. + # (This would work automatically, were publication_scheme not a translated attribute) self.publication_scheme = "" if self.publication_scheme.nil? + + # Set an API key if there isn’t one + self.api_key = SecureRandom.base64(32) if self.api_key.nil? end # like find_by_url_name but also search historic url_name if none found |