Module: HasManyEmails

Defined in:
lib/has_many_emails.rb,
lib/has_many_emails/class_methods.rb,
lib/has_many_emails/instance_methods.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: EmailAddress

Instance Method Summary collapse

Instance Method Details

#has_many_emailsObject

TODO: def has_many_emails(attribute_name, attribute_model_name)



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/has_many_emails.rb', line 13

def has_many_emails
  class_eval <<-EOV

  has_many :email_addresses, :dependent=>:destroy, :class_name => 'HasManyEmails::EmailAddress', :as => :addressee

  validate :validate_email_addresses

  EOV
  
  extend HasManyEmails::ClassMethods
  include HasManyEmails::InstanceMethods

end