4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/globalize/active_record/accessors.rb', line 4
def self.included(base)
base.class_eval do
translated_attribute_names.each do |attr_name|
Globalize.available_locales.each do |locale|
define_method :"#{attr_name}_#{locale}" do
read_attribute(attr_name, {:locale => locale})
end
define_method :"#{attr_name}_#{locale}=" do |value|
changed_attributes[:"#{attr_name}_#{locale}"] = value unless value == read_attribute(attr_name, locale)
write_attribute(attr_name, value, {:locale => locale})
end
end
end
end
end
|