Method: Dynamoid::Associations::ClassMethods#has_many

Defined in:
lib/dynamoid/associations.rb

#has_many(name, options = {}) ⇒ Object

create a has_many association for this document.

Parameters:

  • name (Symbol)

    the name of the association

  • options (Hash) (defaults to: {})

    options to pass to the association constructor

Options Hash (options):

  • :class (Class)

    the target class of the has_many association; that is, the belongs_to class

  • :class_name (Symbol)

    the name of the target class of the association; that is, the name of the belongs_to class

  • :inverse_of (Symbol)

    the name of the association on the target class; that is, if the class has a belongs_to association, the name of that association

Since:

  • 0.2.0



38
39
40
# File 'lib/dynamoid/associations.rb', line 38

def has_many(name, options = {})
  association(:has_many, name, options)
end