diff options
Diffstat (limited to 'app/models/public_body_heading.rb')
-rw-r--r-- | app/models/public_body_heading.rb | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/app/models/public_body_heading.rb b/app/models/public_body_heading.rb index 514821e2c..d49b388bb 100644 --- a/app/models/public_body_heading.rb +++ b/app/models/public_body_heading.rb @@ -16,7 +16,6 @@ class PublicBodyHeading < ActiveRecord::Base default_scope order('display_order ASC') translates :name - accepts_nested_attributes_for :translations, :reject_if => :empty_translation_in_params? validates_uniqueness_of :name, :message => 'Name is already taken' validates_presence_of :name, :message => 'Name can\'t be blank' @@ -29,32 +28,7 @@ class PublicBodyHeading < ActiveRecord::Base end end - # Convenience methods for creating/editing translations via forms - def find_translation_by_locale(locale) - translations.find_by_locale(locale) - end - - def translated_versions - translations - end - - def translated_versions=(translation_attrs) - warn "[DEPRECATION] PublicBodyHeading#translated_versions= will be replaced " \ - "by PublicBodyHeading#translations_attributes= as of release 0.22" - self.translations_attributes = translation_attrs - end - - def ordered_translations - translations. - select { |t| I18n.available_locales.include?(t.locale) }. - sort_by { |t| I18n.available_locales.index(t.locale) } - end - - def build_all_translations - I18n.available_locales.each do |locale| - translations.build(:locale => locale) unless translations.detect{ |t| t.locale == locale } - end - end + include Translatable def add_category(category) unless public_body_categories.include?(category) @@ -69,14 +43,4 @@ class PublicBodyHeading < ActiveRecord::Base 0 end end - - private - - def empty_translation_in_params?(attributes) - attrs_with_values = attributes.select do |key, value| - value != '' and key.to_s != 'locale' - end - attrs_with_values.empty? - end - end |