class IknowParams::Serializer::JsonWithSchema::Rails

Public Class Methods

new(schema) click to toggle source
# File lib/iknow_params/serializer.rb, line 286
def initialize(schema)
  super(schema, validate_schema: !::Rails.env.production?)
end

Public Instance Methods

load(structure) click to toggle source
# File lib/iknow_params/serializer.rb, line 290
def load(structure)
  super(convert_strong_parameters(structure))
end

Private Instance Methods

convert_strong_parameters(structure) click to toggle source
# File lib/iknow_params/serializer.rb, line 296
def convert_strong_parameters(structure)
  case structure
  when ActionController::Parameters
    structure.to_unsafe_h
  when Array
    structure.dup.map { |x| convert_strong_parameters(x) }
  else
    structure
  end
end