A website template with lots of features, built with ruby on rails.

contact_message.rb 372B

12345678910111213141516171819202122
  1. class ContactMessage < ActiveRecord::Base
  2. belongs_to :user
  3. after_create do
  4. send_contact_message
  5. end
  6. def name
  7. if user != nil
  8. name = self.user.first_name.to_s + ' ' + self.user.last_name.to_s
  9. else
  10. name = self.email
  11. end
  12. return name
  13. end
  14. def send_contact_message
  15. Resque.enqueue(SendContactMessage, self.id)
  16. end
  17. end