You are here: Browse Railsplugins Acts As Contactable
You need to run the migrate script create_contacts.rb
How to use:
Let’s assume you have a model named Company, with an ID of 1.
In your company.rb model, add this line:
acts_as_contactable
To attach contacts to this company:
contact = Contact.new contact.contactable_id = 1 contact.contactable_type = “Company” contact.prefix_id = 1 contact.job_title = “President” contact.first_name = “Jane” contact.last_name = “Doe” contact.email = “jane.doe@company.com” contact.phone = “123456” contact.save
contact = Contact.new contact.contactable_id = 1 contact.contactable_type = “Company” contact.prefix_id = 1 contact.job_title = “Alpha Geek” contact.first_name = “Alice” contact.last_name = “Wonders” contact.email = “alice.wonders@company.com” contact.phone = “987654” contact.save
To load the company, including the contacts for this company: c = Company.find(1, :include => :contacts)
This plugin uses a very simplified contacts data model. It does not support: - multiple phone numbers per contact - multiple emails per contact - multiple addresses per contact
NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly