Module: Immortal::BelongsTo

Defined in:
lib/immortal/belongs_to.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/immortal/belongs_to.rb', line 6

def self.included(base)
  base.class_eval do
    class << self

      # Add with/how_deleted singular association readers
      def belongs_to_mortal(name, options = {})
        ::Immortal::BelongsToBuilder.build(self, name, options)
      end

      alias_method :belongs_to_immortal, :belongs_to
      alias_method :belongs_to, :belongs_to_mortal
    end
  end
end