Sha256: a61bcc0d697d31f4444442378e7ebde2e1ccfd6e1d27db70ab677c6fde2798df

Contents?: true

Size: 750 Bytes

Versions: 12

Compression:

Stored size: 750 Bytes

Contents

# frozen_string_literal: true

require 'rails_admin/config/fields/types/text'

module RailsAdmin
  module Config
    module Fields
      module Types
        class Serialized < RailsAdmin::Config::Fields::Types::Text
          # Register field type for the type loader
          RailsAdmin::Config::Fields::Types.register(self)

          register_instance_option :formatted_value do
            RailsAdmin.yaml_dump(value) unless value.nil?
          end

          def parse_value(value)
            value.present? ? (RailsAdmin.yaml_load(value) || nil) : nil
          end

          def parse_input(params)
            params[name] = parse_value(params[name]) if params[name].is_a?(::String)
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rails_admin-3.2.1 lib/rails_admin/config/fields/types/serialized.rb
rails_admin-3.2.0 lib/rails_admin/config/fields/types/serialized.rb
rails_admin-3.2.0.rc lib/rails_admin/config/fields/types/serialized.rb
rails_admin-3.2.0.beta lib/rails_admin/config/fields/types/serialized.rb
rails_admin-3.1.4 lib/rails_admin/config/fields/types/serialized.rb
rails_admin-3.1.3 lib/rails_admin/config/fields/types/serialized.rb
rails_admin-3.1.2 lib/rails_admin/config/fields/types/serialized.rb
rails_admin-3.1.1 lib/rails_admin/config/fields/types/serialized.rb
rails_admin-3.1.0 lib/rails_admin/config/fields/types/serialized.rb
rails_admin-3.1.0.rc2 lib/rails_admin/config/fields/types/serialized.rb
rails_admin-3.1.0.rc lib/rails_admin/config/fields/types/serialized.rb
rails_admin-3.1.0.beta lib/rails_admin/config/fields/types/serialized.rb