Class: ROM::Components::Relation
- Defined in:
- lib/rom/components/relation.rb,
lib/rom/compat/components.rb
Instance Attribute Summary collapse
-
#constant ⇒ .new
readonly
Relation instance builder (typically a class).
Attributes inherited from Core
Instance Method Summary collapse
Methods inherited from Core
#abstract, #apply_external_plugins, #apply_plugins, #components, #gateway?, #gateway_plugins, #id, #inflector, inherited, #key, #namespace, #notifications, #plugin_options, #plugins, #provider_plugins, #trigger, #type
Methods included from Initializer
Instance Attribute Details
#constant ⇒ .new (readonly)
Returns Relation instance builder (typically a class).
11 |
# File 'lib/rom/components/relation.rb', line 11 option :constant, type: Types.Interface(:new) |
Instance Method Details
#adapter ⇒ Object
31 32 33 |
# File 'lib/rom/components/relation.rb', line 31 def adapter config.adapter end |
#build ⇒ ROM::Relation
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rom/components/relation.rb', line 16 def build constant.use(:changeset) constant.use(:registry_reader, relations: registry.relation_ids) # Define view methods if there are any registered view components for this relation local_components.views(relation_id: id).each do |view| view.define(constant) end apply_plugins constant.new(inflector: inflector, registry: registry, **) end |
#local_components ⇒ Object
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.
36 37 38 |
# File 'lib/rom/components/relation.rb', line 36 def local_components constant.components end |