Sha256: b11d4fa290e12f1caaab6426abac70a6c1451335a08b5137985f0ccabdaf61af
Contents?: true
Size: 766 Bytes
Versions: 6
Compression:
Stored size: 766 Bytes
Contents
require 'rails_admin/config/fields/types/text' module RailsAdmin module Config module Fields module Types class Json < RailsAdmin::Config::Fields::Types::Text # Register field type for the type loader RailsAdmin::Config::Fields::Types.register(self) RailsAdmin::Config::Fields::Types.register(:jsonb, self) register_instance_option :formatted_value do value.present? ? JSON.pretty_generate(value) : nil end def parse_value(value) value.present? ? JSON.parse(value) : 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
6 entries across 6 versions & 1 rubygems