Module: ActiveRecord::Validations

Included in:
Base
Defined in:
lib/gettext/active_record.rb

Overview

:nodoc:

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.append_features_with_gettext(base) ⇒ Object

Since rails-1.2.0.



86
87
88
89
90
91
# File 'lib/gettext/active_record.rb', line 86

def append_features_with_gettext(base) # :nodoc:
  unless base <= ActiveRecord::Base
    append_features_without_gettext(base)
  end
  real_included(base)
end

.included_with_gettext(base) ⇒ Object

:nodoc:



75
76
77
78
79
80
# File 'lib/gettext/active_record.rb', line 75

def included_with_gettext(base) # :nodoc:
  unless base <= ActiveRecord::Base
    included_without_gettext(base)
  end
  real_included(base)
end

.real_included(base) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/gettext/active_record.rb', line 53

def real_included(base)
  base.extend ClassMethods
  base.class_eval{
    include GetText
    def gettext(str)  #:nodoc:
      _(str)
    end
    class << self
      def human_attribute_name_with_gettext(attribute_key_name) #:nodoc:
        s_("#{self}|#{attribute_key_name.humanize}")
      end
      alias_method_chain :human_attribute_name, :gettext
      def human_attribute_table_name_for_error(table_name) #:nodoc:
        _(table_name.gsub(/_/, " "))
      end
    end
  }
end

Instance Method Details

#custom_error_messages_dObject

:nodoc:



142
143
144
# File 'lib/gettext/active_record.rb', line 142

def custom_error_messages_d  #:nodoc:
  self.class.custom_error_messages_d
end