Sha256: 6749ffb5a3e527fbfb8febbfc8bd4038ca56c33f6db2d0cf9a9088bc66fc41ce

Contents?: true

Size: 652 Bytes

Versions: 2

Compression:

Stored size: 652 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) unless value.nil?
          end

          def parse_input(params)
            return unless params[name].is_a?(::String)
            params[name] = (params[name].blank? ? nil : (SafeYAML.load(params[name]) || nil))
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/rails_admin-0.7.0/lib/rails_admin/config/fields/types/serialized.rb
rails_admin-0.7.0 lib/rails_admin/config/fields/types/serialized.rb