Sha256: d5df78590e1a02820c94097ffcb06c137be97f7c9349558ff9d00c50a1719bd5

Contents?: true

Size: 590 Bytes

Versions: 59

Compression:

Stored size: 590 Bytes

Contents

module Para
  module ModelFieldParsers
    class Globalize < Para::ModelFieldParsers::Base
      register :globalize, self

      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

      def applicable?
        defined?(::Globalize) && model.translates?
      end
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
para-0.12.4 lib/para/model_field_parsers/globalize.rb
para-0.12.3 lib/para/model_field_parsers/globalize.rb
para-0.12.2 lib/para/model_field_parsers/globalize.rb
para-0.12.1 lib/para/model_field_parsers/globalize.rb
para-0.12.0 lib/para/model_field_parsers/globalize.rb
para-0.11.4 lib/para/model_field_parsers/globalize.rb
para-0.11.3 lib/para/model_field_parsers/globalize.rb
para-0.11.2 lib/para/model_field_parsers/globalize.rb
para-0.11.1 lib/para/model_field_parsers/globalize.rb
para-0.11.0 lib/para/model_field_parsers/globalize.rb
para-0.10.0 lib/para/model_field_parsers/globalize.rb
para-0.9.4 lib/para/model_field_parsers/globalize.rb
para-0.9.3.3 lib/para/model_field_parsers/globalize.rb
para-0.9.3.2 lib/para/model_field_parsers/globalize.rb
para-0.9.3.1 lib/para/model_field_parsers/globalize.rb
para-0.9.2 lib/para/model_field_parsers/globalize.rb
para-0.9.0 lib/para/model_field_parsers/globalize.rb
para-0.8.15 lib/para/model_field_parsers/globalize.rb
para-0.8.14 lib/para/model_field_parsers/globalize.rb
para-0.8.13 lib/para/model_field_parsers/globalize.rb