Module: MailEngine::ActsAsMailReceiver::ClassMethods

Defined in:
lib/mail_engine/acts_as_mail_receiver.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_mail_receiver(options) ⇒ Object

NOTICE: Please put this code below any “scope” statement. Here you can define:

  1. Which columns can be acted as payload items.

  2. Which methods can be user group scopes.

Example

class User < AR
  acts_as_mail_receiver :payload_columns => %w{firstname lastname},
                        :groups => %w{all english_users chinese_users},
                        :skip_method_existance_check => true
end


27
28
29
30
31
32
33
# File 'lib/mail_engine/acts_as_mail_receiver.rb', line 27

def acts_as_mail_receiver(options)
  [:payload_columns, :groups].each do |key|
    methods_array = Array.wrap(options[key]) || []
    self.send("#{key}=", methods_array)
  end
  check_method_existance! unless options[:skip_method_existance_check]
end