Module: ROM::Plugins::Relation::KeyInference

Defined in:
lib/rom/plugins/relation/key_inference.rb

Instance Method Summary collapse

Instance Method Details

#base_nameSymbol

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.

Return base name which defaults to name attribute

Returns:

  • (Symbol)


21
22
23
# File 'lib/rom/plugins/relation/key_inference.rb', line 21

def base_name
  name
end

#foreign_keySymbol

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.

Infer foreign_key name for this relation

TODO: this should be configurable and handled by an injected policy

Returns:

  • (Symbol)


12
13
14
# File 'lib/rom/plugins/relation/key_inference.rb', line 12

def foreign_key
  :"#{Inflector.singularize(name)}_id"
end