Sha256: 04c54579bac8ba8882ceb51deace6c9ac2bbcd26d5d8e74ee97666637c9dbc2b
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
module ActiveData module Model module Attributes module Reflections class Localized < Attribute def self.build target, generated_methods, name, *args, &block attribute = super(target, generated_methods, name, *args, &block) generate_methods name, generated_methods attribute end def self.generate_methods name, target target.class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{name}_translations attribute('#{name}').read end def #{name}_translations= value attribute('#{name}').write(value) end def #{name} attribute('#{name}').read_locale(self.class.locale) end def #{name}= value attribute('#{name}').write_locale(value, self.class.locale) end def #{name}? attribute('#{name}').locale_query(self.class.locale) end def #{name}_before_type_cast attribute('#{name}').read_locale_before_type_cast(self.class.locale) end RUBY end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_data-1.0.0 | lib/active_data/model/attributes/reflections/localized.rb |