Sha256: 6570ca0c927123e5bdf87ca479c27a4c32e49bf73b07c7508b271622a50d95dd
Contents?: true
Size: 760 Bytes
Versions: 14
Compression:
Stored size: 760 Bytes
Contents
module ZTK::DSL::Core # @author Zachary Patten <zachary AT jovelabs DOT com> # @api private module Relations require 'ztk/dsl/core/relations/belongs_to' require 'ztk/dsl/core/relations/has_many' def self.included(base) base.class_eval do base.send(:extend, ZTK::DSL::Core::Relations::ClassMethods) base.send(:include, ZTK::DSL::Core::Relations::BelongsTo) base.send(:include, ZTK::DSL::Core::Relations::HasMany) end end # @author Zachary Patten <zachary AT jovelabs DOT com> module ClassMethods def add_relation(key) relation_key = "#{key}_relations" cattr_accessor relation_key send(relation_key) || send("#{relation_key}=", {}) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems