Sha256: 93d179e7b82cd9d7a60460870d95f6ad268147495038165a15cc4ac44d05a20b

Contents?: true

Size: 604 Bytes

Versions: 3

Compression:

Stored size: 604 Bytes

Contents

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
            YAML.dump(value)
          end

          def parse_input(params)
            params[name] = (params[name].blank? ? nil : YAML.safe_load(params[name])) if params[name].is_a?(::String)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_admin-0.4.6 lib/rails_admin/config/fields/types/serialized.rb
rails_admin-0.4.5 lib/rails_admin/config/fields/types/serialized.rb
rails_admin-0.4.4 lib/rails_admin/config/fields/types/serialized.rb