lib/hanami/model/associations/dsl.rb in hanami-model-1.0.4 vs lib/hanami/model/associations/dsl.rb in hanami-model-1.1.0.beta1

- old
+ new

@@ -13,16 +13,22 @@ instance_eval(&blk) end # @since 0.7.0 # @api private - def has_many(relation, *) + def has_many(relation, **args) @repository.__send__(:relations, relation) + @repository.__send__(:relations, args[:through]) if args[:through] end - # @since 0.7.0 + def has_one(relation, *) + @repository.__send__(:relations, Hanami::Utils::String.pluralize(relation).to_sym) + end + + # @since 1.1.0 # @api private - def belongs_to(*) + def belongs_to(relation, *) + @repository.__send__(:relations, Hanami::Utils::String.pluralize(relation).to_sym) end end end end end