Sha256: d5d1fb327a177d8bb36aa9cffa2023734060e0d4cef012c542ac1767d575916e
Contents?: true
Size: 826 Bytes
Versions: 9
Compression:
Stored size: 826 Bytes
Contents
module HasManyTranslations # Simply adds a flag to determine whether a model class is has_translations. module Translated def self.extended(base) # :nodoc: base.class_eval do class << self alias_method_chain :translated, :flag end end end # Overrides the +translated?+ method to first define the +translated?+ class method before # deferring to the original +translated+. def translated_with_flag(*args) translated_without_flag(*args) class << self def translated? true end end end # For all ActiveRecord::Base models that do not call the +translated?+ method, the +has_translations?+ # method will return false. def translated? false end end end
Version data entries
9 entries across 9 versions & 1 rubygems