aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/public_body.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 9efeadf55..97802c7e8 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
# == Schema Information
#
# Table name: public_bodies
@@ -91,8 +92,9 @@ class PublicBody < ActiveRecord::Base
# 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
+ end
+
+ def before_save
self.api_key = SecureRandom.base64(33) if self.api_key.nil?
end