Module: HasManyTranslations::Translated
- Defined in:
- lib/has_many_translations/translated.rb
Overview
Simply adds a flag to determine whether a model class is has_translations.
Class Method Summary collapse
-
.extended(base) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#translated? ⇒ Boolean
For all ActiveRecord::Base models that do not call the
translated?
method, thehas_translations?
method will return false. -
#translated_with_flag(*args) ⇒ Object
Overrides the
translated?
method to first define thetranslated?
class method before deferring to the originaltranslated
.
Class Method Details
.extended(base) ⇒ Object
:nodoc:
5 6 7 8 9 10 11 |
# File 'lib/has_many_translations/translated.rb', line 5 def self.extended(base) # :nodoc: base.class_eval do class << self alias_method_chain :translated, :flag end end end |
Instance Method Details
#translated? ⇒ Boolean
For all ActiveRecord::Base models that do not call the translated?
method, the has_translations?
method will return false.
28 29 30 |
# File 'lib/has_many_translations/translated.rb', line 28 def translated? false end |
#translated_with_flag(*args) ⇒ Object
Overrides the translated?
method to first define the translated?
class method before deferring to the original translated
.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/has_many_translations/translated.rb', line 14 def translated_with_flag(*args) translated_without_flag(*args) class << self def translated? true end end end |