Module: HasMailbox::Models::ClassMethods

Defined in:
lib/has_mailbox/has_mailbox.rb

Instance Method Summary collapse

Instance Method Details

#has_mailboxObject



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

def has_mailbox
  class_eval do
    has_many  :sent_messages, 
                 :as => :sent_messageable,
                 :class_name => "HasMailbox::Models::MessageCopy", 
                 :dependent => :destroy
    
    has_many  :received_messages, 
                 :as => :received_messageable, 
                 :class_name => "HasMailbox::Models::Message", 
                 :dependent => :destroy
     	            
  end
  
  include HasMailbox::Models::InstanceMethods
end