Method: Dynamoid::Associations::ClassMethods#has_one

Defined in:
lib/dynamoid/associations.rb

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

create a has_one 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_one 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



51
52
53
# File 'lib/dynamoid/associations.rb', line 51

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