Class: Hanami::Model::Associations::Dsl Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/model/associations/dsl.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Auto-infer relations linked to repository’s associations

Since:

  • 0.7.0

Instance Method Summary collapse

Constructor Details

#initialize(repository, &blk) ⇒ Dsl

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.

Returns a new instance of Dsl.

Since:

  • 0.7.0



11
12
13
14
# File 'lib/hanami/model/associations/dsl.rb', line 11

def initialize(repository, &blk)
  @repository = repository
  instance_eval(&blk)
end

Instance Method Details

#belongs_toObject

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.

Since:

  • 0.7.0



24
25
# File 'lib/hanami/model/associations/dsl.rb', line 24

def belongs_to(*)
end

#has_many(relation) ⇒ 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.

Since:

  • 0.7.0



18
19
20
# File 'lib/hanami/model/associations/dsl.rb', line 18

def has_many(relation, *)
  @repository.__send__(:relations, relation)
end