Module: Pragma::Decorator::Association::Adapter Private
- Defined in:
- lib/pragma/decorator/association/adapter.rb,
lib/pragma/decorator/association/adapter/base.rb,
lib/pragma/decorator/association/adapter/poro.rb,
lib/pragma/decorator/association/adapter/active_record.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Adapters make associations ORM-independent by providing support for multiple underlying libraries like ActiveRecord and simple POROs.
Defined Under Namespace
Classes: ActiveRecord, Base, Poro
Constant Summary collapse
- SUPPORTED_ADAPTERS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The list of supported adapters, in order of priority.
[ActiveRecord, Poro].freeze
Class Method Summary collapse
-
.load_for(bond) ⇒ Adapter::Base
private
Loads the adapter for the given association bond.
Class Method Details
.load_for(bond) ⇒ Adapter::Base
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.
Loads the adapter for the given association bond.
This will try SUPPORTED_ADAPTERS in order until it finds an adapter that supports the bond’s model. When the adapter is found, it will return a new instance of it.
24 25 26 27 28 |
# File 'lib/pragma/decorator/association/adapter.rb', line 24 def self.load_for(bond) SUPPORTED_ADAPTERS.find do |adapter| adapter.supports?(bond.model) end.new(bond) end |