Method: Graphiti::Util::Persistence#initialize
- Defined in:
- lib/graphiti/util/persistence.rb
#initialize(resource, meta, attributes, relationships, caller_model, foreign_key = nil) ⇒ Persistence
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Persistence.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/graphiti/util/persistence.rb', line 10 def initialize(resource, , attributes, relationships, caller_model, foreign_key = nil) @resource = resource = @attributes = attributes @relationships = relationships @caller_model = caller_model @foreign_key = foreign_key @adapter = @resource.adapter # Find the correct child resource for a given jsonapi type if ( = [:type].try(:to_sym)) if @resource.type != && @resource.polymorphic? @resource = @resource.class.resource_for_type().new end end end |