module Immortal::BelongsTo
Includes this to add +association_{with/only}_deleted+ accessors for belongs_to
associations.
Public Class Methods
belongs_to(name, scope = nil, options = {})
Also aliased as: belongs_to_immortal
Alias for: belongs_to_mortal
belongs_to_mortal(name, scope = nil, options = {})
click to toggle source
Add with/how_deleted singular association readers
# File lib/immortal/belongs_to.rb, line 11 def belongs_to_mortal(name, scope = nil, options = {}) reflection = BelongsToBuilder.build(self, name, scope, options) ActiveRecord::Reflection.add_reflection self, name, reflection end
Also aliased as: belongs_to
included(base)
click to toggle source
# File lib/immortal/belongs_to.rb, line 7 def self.included(base) base.class_eval do class << self # Add with/how_deleted singular association readers def belongs_to_mortal(name, scope = nil, options = {}) reflection = BelongsToBuilder.build(self, name, scope, options) ActiveRecord::Reflection.add_reflection self, name, reflection end alias_method :belongs_to_immortal, :belongs_to alias_method :belongs_to, :belongs_to_mortal end end end