Sha256: ef3ab9e05c94551e81c9087bcf0c9474d4882b36c0cc2626ac7bf86fda3d386c
Contents?: true
Size: 563 Bytes
Versions: 16
Compression:
Stored size: 563 Bytes
Contents
module Railjet module Util module FormHelper def form(klass) klass.new(clean_params).tap(&:validate!) end private def object_params raise NotImplementedError end def clean_params object_params end def respond_with_errors(object_with_errors, status: :unprocessable_entity) raise ArgumentError unless object_with_errors.respond_to?(:errors) response = object_with_errors.errors.to_hash(true) render json: response, status: status end end end end
Version data entries
16 entries across 16 versions & 1 rubygems