Module: ROM::SQL::Plugin::Associates::ClassMethods Private
- Defined in:
- lib/rom/sql/plugin/associates.rb
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.
Instance Method Summary collapse
-
#associates(name, options) ⇒ Object
Set command to associate tuples with a parent tuple using provided keys.
- #inherited(klass) ⇒ Object private
Instance Method Details
#associates(name, options) ⇒ Object
Set command to associate tuples with a parent tuple using provided keys
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/rom/sql/plugin/associates.rb', line 65 def associates(name, ) if associations.include?(name) raise( ArgumentError, "#{name} association is already defined for #{self.class}" ) end option :association, reader: true, default: -> command { } include InstanceMethods associations << name end |
#inherited(klass) ⇒ 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.
38 39 40 41 42 |
# File 'lib/rom/sql/plugin/associates.rb', line 38 def inherited(klass) klass.defines :associations klass.associations [] super end |