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.8.12 lib/para/model_field_parsers/globalize.rb
para-0.8.11 lib/para/model_field_parsers/globalize.rb
para-0.8.10 lib/para/model_field_parsers/globalize.rb
para-0.8.9 lib/para/model_field_parsers/globalize.rb
para-0.8.8 lib/para/model_field_parsers/globalize.rb
para-0.8.7 lib/para/model_field_parsers/globalize.rb
para-0.8.5 lib/para/model_field_parsers/globalize.rb
para-0.8.3.3 lib/para/model_field_parsers/globalize.rb
para-0.8.3.2 lib/para/model_field_parsers/globalize.rb
para-0.8.3.1 lib/para/model_field_parsers/globalize.rb
para-0.8.3 lib/para/model_field_parsers/globalize.rb
para-0.8.2.3 lib/para/model_field_parsers/globalize.rb
para-0.8.2.2 lib/para/model_field_parsers/globalize.rb
para-0.8.2.1 lib/para/model_field_parsers/globalize.rb
para-0.8.2 lib/para/model_field_parsers/globalize.rb
para-0.8.1 lib/para/model_field_parsers/globalize.rb
para-0.8.0 lib/para/model_field_parsers/globalize.rb
para-0.7.4.p1 lib/para/model_field_parsers/globalize.rb
para-0.7.4 lib/para/model_field_parsers/globalize.rb
para-0.7.3.p6 lib/para/model_field_parsers/globalize.rb