Class: ActiveShopifyGraphQL::Model
- Inherits:
-
Object
- Object
- ActiveShopifyGraphQL::Model
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::AttributeAssignment, ActiveModel::Validations, Associations, Attributes, Connections, FinderMethods, GraphqlTypeResolver, LoaderSwitchable, MetafieldAttributes
- Defined in:
- lib/active_shopify_graphql/model.rb
Overview
Base class for all GraphQL-backed models.
Models should inherit from this class (typically via an ApplicationShopifyGqlRecord intermediate class) to gain ActiveRecord-like functionality for Shopify GraphQL APIs.
Defined Under Namespace
Modules: Associations, Attributes, Connections, FinderMethods, GraphqlTypeResolver, LoaderSwitchable, MetafieldAttributes
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Model
constructor
A new instance of Model.
Methods included from LoaderSwitchable
#with_admin_api, #with_customer_account_api, #with_loader
Methods included from Connections
#populate_inverse_cache_for_connection
Methods included from GraphqlTypeResolver
Constructor Details
#initialize(attributes = {}) ⇒ Model
Returns a new instance of Model.
36 37 38 39 40 41 42 43 44 |
# File 'lib/active_shopify_graphql/model.rb', line 36 def initialize(attributes = {}) # Extract connection cache if present and populate inverse caches if attributes.key?(:_connection_cache) @_connection_cache = attributes.delete(:_connection_cache) populate_inverse_caches_on_initialization end assign_attributes(attributes) end |