Module Professionalnerd::SimplePrivateMessages::PrivateMessageExtensions::ActMethods
In: lib/professionalnerd/simple_private_messages/private_message_extensions.rb

Methods

Included Modules

InstanceMethods

Public Instance methods

Sets up a model to be a private message model, defining the parent class as specified in :class_name (typically "User") Provides the following instance methods:

  • sender - the sender of the message.
  • recipient - the recipient of the message.

[Source]

    # File lib/professionalnerd/simple_private_messages/private_message_extensions.rb, line 13
13:         def is_private_message(options = {})
14:           options[:class_name] ||= 'User'
15:           
16:           unless included_modules.include? InstanceMethods 
17:             belongs_to :sender,
18:                        :class_name => options[:class_name],
19:                        :foreign_key => 'sender_id'
20:             belongs_to :recipient,
21:                        :class_name => options[:class_name],
22:                        :foreign_key => 'recipient_id'
23: 
24:             extend ClassMethods 
25:             include InstanceMethods 
26:           end 
27:         end

[Validate]