Class: Para::ModelFieldParsers::Globalize
- Inherits:
-
Base
- Object
- Base
- Para::ModelFieldParsers::Globalize
show all
- Defined in:
- lib/para/model_field_parsers/globalize.rb
Instance Attribute Summary
Attributes inherited from Base
#fields_hash, #model
Instance Method Summary
collapse
Methods inherited from Base
#initialize, register
Instance Method Details
#applicable? ⇒ Boolean
18
19
20
|
# File 'lib/para/model_field_parsers/globalize.rb', line 18
def applicable?
defined?(::Globalize) && model.translates?
end
|
#parse! ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/para/model_field_parsers/globalize.rb', line 6
def parse!
fields_hash.delete(:translations)
model.translated_attribute_names.each do |attribute_name|
column = model.translation_class.columns_hash[attribute_name.to_s]
fields_hash[column.name] = AttributeField::Translation.new(
model, name: column.name, type: column.type
)
end
end
|