Sha256: 39f10fc9921b96fd82a33c809e69bf407fd25ce338d33ad4ae1d55ade9c04ec5
Contents?: true
Size: 620 Bytes
Versions: 1
Compression:
Stored size: 620 Bytes
Contents
module ForestRails class ResourceDeserializer def initialize(params) @params = params end def perform @attributes = extract_attributes extract_relationships @attributes end def extract_attributes @params.require(:attributes).permit! end def extract_relationships if @params[:relationships] @params[:relationships].each do |name, relationship| data = relationship[:data] if data.is_a?(Hash) @attributes[data[:type].singularize.foreign_key] = data[:id] end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
forest_rails-0.0.4 | app/deserializers/forest_rails/resource_deserializer.rb |