Sha256: 18a29e286c3ed91384fe5744606415e6d8d51c64d5d808abe6d31b5ce139da67

Contents?: true

Size: 586 Bytes

Versions: 1

Compression:

Stored size: 586 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.load(params[name]))
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
obitum-rails_admin-0.0.3 lib/rails_admin/config/fields/types/serialized.rb