Sha256: 03758eb3fad8212c84d843b8a8fe3c8c705c3853b79dfd7b72266eb7cff6a57d
Contents?: true
Size: 654 Bytes
Versions: 4
Compression:
Stored size: 654 Bytes
Contents
module PrettyApi module Helpers extend ActiveSupport::Concern included do def pretty_nested_attributes(record, params, attrs = nil) params = params.to_h.with_indifferent_access attrs ||= PrettyApi::ActiveRecord::Associations.nested_attributes_tree(record.class) PrettyApi::Parameters::NestedAttributes.new(nested_tree: attrs).parse(record, params) end def pretty_nested_errors(record, attrs = nil) attrs ||= PrettyApi::ActiveRecord::Associations.nested_attributes_tree(record.class) PrettyApi::Errors::NestedErrors.new(nested_tree: attrs).parse(record) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
pretty-api-0.4.1 | lib/pretty_api/helpers.rb |
pretty-api-0.4.0 | lib/pretty_api/helpers.rb |
pretty-api-0.3.1 | lib/pretty_api/helpers.rb |
pretty-api-0.3.0 | lib/pretty_api/helpers.rb |