diff options
author | Gareth Rees <gareth@mysociety.org> | 2015-06-03 17:24:31 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2015-06-15 16:11:11 +0100 |
commit | f44bcb39c2c25a3d41f433ac7fbf714e722ba418 (patch) | |
tree | 2fc76af6082a30ab13af0b25389a905c84d4d9c6 | |
parent | 5f88e09872f4fc5138233d29323b587e06199a0b (diff) |
Deprecate PublicBody#calculate_cached_fields
Not used anywhere.
Moved it to the bottom of the file out of the way.
-rw-r--r-- | app/models/public_body.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 3a6dd58fb..0a394dadf 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -186,14 +186,6 @@ class PublicBody < ActiveRecord::Base uniq end - # TODO: - Don't like repeating this! - def calculate_cached_fields(t) - PublicBody.set_first_letter(t) - short_long_name = t.name - short_long_name = t.short_name if t.short_name and !t.short_name.empty? - t.url_name = MySociety::Format.simplify_url_part(short_long_name, 'body') - end - # Set the first letter on a public body or translation def self.set_first_letter(instance) unless instance.name.nil? or instance.name.empty? @@ -717,6 +709,16 @@ class PublicBody < ActiveRecord::Base return bodies end + def calculate_cached_fields(t) + warn %q([DEPRECATION] PublicBody#calculate_cached_fields will be removed + in 0.23).squish + + PublicBody.set_first_letter(t) + short_long_name = t.name + short_long_name = t.short_name if t.short_name and !t.short_name.empty? + t.url_name = MySociety::Format.simplify_url_part(short_long_name, 'body') + end + private # Read an attribute value (without using locale fallbacks if the attribute is translated) |