Class: StaticModel::Associations::BelongsToAssociation

Inherits:
Association
  • Object
show all
Defined in:
lib/static_model/associations.rb

Instance Attribute Summary

Attributes inherited from Association

#foreign_key, #klass, #name, #options

Instance Method Summary collapse

Methods inherited from Association

#initialize, #reflection_klass

Constructor Details

This class inherits a constructor from StaticModel::Associations::Association

Instance Method Details

#define_association_methodsObject



72
73
74
75
76
77
78
# File 'lib/static_model/associations.rb', line 72

def define_association_methods
  klass.module_eval <<-EOT
    def #{name}
      #{reflection_klass}.send(:find, #{foreign_key})
    end
  EOT
end