Module: AttrTranslatable::Base::ClassMethods

Defined in:
lib/attr_translatable/base.rb

Instance Method Summary collapse

Instance Method Details

#attr_translatable(*args) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/attr_translatable/base.rb', line 10

def attr_translatable(*args)
  attrs = validate_attrs(args)
  unless ancestors.include?(AttrTranslatable::Translation)
    @translatable_attrs = attrs
    has_many :attr_translations, :as => :model, :dependent => :destroy
    include AttrTranslatable::Translation
  end
end

#translatable_attrsObject



19
20
21
# File 'lib/attr_translatable/base.rb', line 19

def translatable_attrs
  @translatable_attrs || []
end