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
105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/rom/sql/plugin/associates.rb', line 105 def associates(name, = {}) if associations.map(&:first).include?(name) raise ArgumentError, "#{name} association is already defined for #{self.class}" end option :association, reader: true, default: {} 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.
78 79 80 81 82 |
# File 'lib/rom/sql/plugin/associates.rb', line 78 def inherited(klass) klass.defines :associations klass.associations [] super end |