Sha256: 0682b11b15114e378b21e5576a99830aab8a00a0510db493d55bc44e7867d3c2
Contents?: true
Size: 1.05 KB
Versions: 13
Compression:
Stored size: 1.05 KB
Contents
module Hanami module Model module Associations # Auto-infer relations linked to repository's associations # # @since 0.7.0 # @api private # # rubocop:disable Naming/PredicateName class Dsl # @since 0.7.0 # @api private def initialize(repository, &blk) @repository = repository instance_eval(&blk) end # @since 0.7.0 # @api private def has_many(relation, **args) @repository.__send__(:relations, relation) @repository.__send__(:relations, args[:through]) if args[:through] end # @since 1.1.0 # @api private def has_one(relation, *) @repository.__send__(:relations, Hanami::Utils::String.pluralize(relation).to_sym) end # @since 1.1.0 # @api private def belongs_to(relation, *) @repository.__send__(:relations, Hanami::Utils::String.pluralize(relation).to_sym) end end # rubocop:enable Naming/PredicateName end end end
Version data entries
13 entries across 13 versions & 1 rubygems