Sha256: 76ee5594336b7d1a698ca9ac40421bbcbc7ac564d8ad9e24fb71b780fbd0934d
Contents?: true
Size: 531 Bytes
Versions: 15
Compression:
Stored size: 531 Bytes
Contents
module RestfulResource module RailsValidations module ClassMethods def put(id, data: {}, **params) begin super(id, data: data, **params) rescue HttpClient::UnprocessableEntity => e errors = parse_json(e.response.body) result = data.merge(errors) self.new(result) end end end def self.included(base) base.extend(ClassMethods) end def valid? @inner_object.errors.nil? || @inner_object.errors.count == 0 end end end
Version data entries
15 entries across 15 versions & 1 rubygems