Sha256: 00b1c16c53955b55ec4142875e0eae5ca491dbabbe6a9c4c4d36c65152fb2507
Contents?: true
Size: 693 Bytes
Versions: 15
Compression:
Stored size: 693 Bytes
Contents
require 'ostruct' module Relationships def relationships OpenStruct.new({has_many: @has_many ||= [], has_one: @has_one ||= [], belongs_to: @belongs_to ||= [], has_and_belongs_to_many: @has_and_belongs_to_many ||= []}) end private def has_many(*args) @has_many ||= [] @has_many.push [args.first] end def has_one(*args) @has_one ||= [] @has_one.push [args.first] end def belongs_to(*args) @belongs_to ||= [] @belongs_to.push [args.first] end def has_and_belongs_to_many(*args) @has_and_belongs_to_many ||= [] @has_and_belongs_to_many.push [args.first] end end
Version data entries
15 entries across 15 versions & 1 rubygems