Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Includes:
- Validations, GetText
- Defined in:
- lib/gettext_activerecord/base.rb
Overview
:nodoc:
Constant Summary collapse
- @@gettext_untranslate =
Hash.new(false)
- @@gettext_untranslate_columns =
{}
Class Method Summary collapse
- .columns_with_gettext_activerecord ⇒ Object
-
.untranslate(*w) ⇒ Object
Sets the untranslate columns.
-
.untranslate?(columnname) ⇒ Boolean
Returns true if the column is set “untranslate”.
-
.untranslate_all ⇒ Object
Untranslate all of the tablename/fieldnames in this model class.
-
.untranslate_all? ⇒ Boolean
Returns true if “untranslate_all” is called.
-
.untranslate_data ⇒ Object
:nodoc:.
Methods included from Validations
append_features_with_gettext_activerecord, included_with_gettext_activerecord, real_included
Methods included from GetText
#update_pofiles, #update_pofiles_org
Class Method Details
.columns_with_gettext_activerecord ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/gettext_activerecord/base.rb', line 55 def columns_with_gettext_activerecord unless defined? @columns @columns = nil end unless @columns @columns = columns_without_gettext_activerecord @columns.each {|column| column.table_class = self } end @columns end |
.untranslate(*w) ⇒ Object
Sets the untranslate columns.
(e.g.)
Person < ActiveRecord::Base
untranslate :age, :address
end
38 39 40 41 42 |
# File 'lib/gettext_activerecord/base.rb', line 38 def untranslate(*w) ary = @@gettext_untranslate_columns[self] || [] ary += w.collect{|v| v.to_s} @@gettext_untranslate_columns[self] = ary end |
.untranslate?(columnname) ⇒ Boolean
Returns true if the column is set “untranslate”.
(e.g.) untranslate? :foo
46 47 48 49 |
# File 'lib/gettext_activerecord/base.rb', line 46 def untranslate?(columnname) ary = @@gettext_untranslate_columns[self] || [] ary.include?(columnname) end |
.untranslate_all ⇒ Object
Untranslate all of the tablename/fieldnames in this model class.
(e.g.)
Person < ActiveRecord::Base
untranslate_all
end
24 25 26 |
# File 'lib/gettext_activerecord/base.rb', line 24 def untranslate_all @@gettext_untranslate[self] = true end |
.untranslate_all? ⇒ Boolean
Returns true if “untranslate_all” is called. Otherwise false.
29 30 31 |
# File 'lib/gettext_activerecord/base.rb', line 29 def untranslate_all? @@gettext_untranslate[self] end |
.untranslate_data ⇒ Object
:nodoc:
51 52 53 |
# File 'lib/gettext_activerecord/base.rb', line 51 def untranslate_data #:nodoc: [@@gettext_untranslate[self], @@gettext_untranslate_columns[self] || []] end |