From 1cc40a0bf8b1aa7cfb22c8a6e393c138a334802c Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Mon, 1 Sep 2014 15:55:55 -0300 Subject: [PATCH] hotfix to manage translation --- app/models/article.rb | 7 +++++-- app/models/change_password.rb | 7 +++++-- app/models/user.rb | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/models/article.rb b/app/models/article.rb index 844385d..80e4837 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -172,14 +172,17 @@ class Article < ActiveRecord::Base self.profile end - def self.human_attribute_name(attrib, options = {}) + def self.human_attribute_name_with_customization(attrib, options={}) case attrib.to_sym when :name _('Title') else - _(self.superclass.human_attribute_name(attrib)) + _(self.human_attribute_name_without_customization(attrib)) end end + class << self + alias_method_chain :human_attribute_name, :customization + end def css_class_list [self.class.name.to_css_class] diff --git a/app/models/change_password.rb b/app/models/change_password.rb index 6209372..f3c7a9a 100644 --- a/app/models/change_password.rb +++ b/app/models/change_password.rb @@ -2,16 +2,19 @@ class ChangePassword < Task attr_accessor :password, :password_confirmation - def self.human_attribute_name(attrib, options = {}) + def self.human_attribute_name_with_customization(attrib, options={}) case attrib.to_sym when :password _('Password') when :password_confirmation _('Password Confirmation') else - _(self.superclass.human_attribute_name(attrib)) + _(self.human_attribute_name_without_customization(attrib)) end end + class << self + alias_method_chain :human_attribute_name, :customization + end validates_presence_of :requestor diff --git a/app/models/user.rb b/app/models/user.rb index 32a029c..9b9e01d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -17,15 +17,18 @@ class User < ActiveRecord::Base end # FIXME ugly workaround - def self.human_attribute_name(attrib, options={}) + def self.human_attribute_name_with_customization(attrib, options={}) case attrib.to_sym when :login return [_('Username'), _('Email')].join(' / ') when :email return _('e-Mail') - else _(self.superclass.human_attribute_name(attrib)) + else _(self.human_attribute_name_without_customization(attrib)) end end + class << self + alias_method_chain :human_attribute_name, :customization + end before_create do |user| if user.environment.nil? -- libgit2 0.21.2