module SelfishAssociations::Base::ClassMethods
Public Instance Methods
has_many_selfish(name, scope = nil, **options)
click to toggle source
# File lib/selfish_associations/base.rb, line 21 def has_many_selfish(name, scope = nil, **options) SelfishAssociations::Builder.new(self).add_association(name, SelfishAssociations::Associations::HasMany.new(name, self, scope, options)) end
has_one_selfish(name, scope = nil, **options)
click to toggle source
# File lib/selfish_associations/base.rb, line 17 def has_one_selfish(name, scope = nil, **options) SelfishAssociations::Builder.new(self).add_association(name, SelfishAssociations::Associations::HasOne.new(name, self, scope, options)) end
selfish_joins(name)
click to toggle source
# File lib/selfish_associations/base.rb, line 25 def selfish_joins(name) assoc = self.selfish_associations[name] or raise SelfishException, "No selfish_associations named #{name} found, perhaps you misspelled it?" assoc.join end