Module: CassandraObject::BelongsTo::ClassMethods
- Defined in:
- lib/cassandra_object/belongs_to.rb
Instance Method Summary collapse
-
#belongs_to(name, options = {}) ⇒ Object
Options [:class_name] Use if the class cannot be inferred from the association [:polymorphic] Specify if the association is polymorphic Example: class Driver < CassandraObject::Base end class Truck < CassandraObject::Base end.
- #generated_belongs_to_methods ⇒ Object
Instance Method Details
#belongs_to(name, options = {}) ⇒ Object
Options
- :class_name
-
Use if the class cannot be inferred from the association
- :polymorphic
-
Specify if the association is polymorphic
Example:
class Driver < CassandraObject::Base
end
class Truck < CassandraObject::Base
end
21 22 23 |
# File 'lib/cassandra_object/belongs_to.rb', line 21 def belongs_to(name, = {}) CassandraObject::BelongsTo::Builder.build(self, name, ) end |
#generated_belongs_to_methods ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/cassandra_object/belongs_to.rb', line 25 def generated_belongs_to_methods @generated_belongs_to_methods ||= begin mod = const_set(:GeneratedBelongsToMethods, Module.new) include mod mod end end |