Skip to content

Instantly share code, notes, and snippets.

@kyleslattery
Created August 5, 2009 14:38
Show Gist options
  • Save kyleslattery/162702 to your computer and use it in GitHub Desktop.
Save kyleslattery/162702 to your computer and use it in GitHub Desktop.
class ContactEmail < ActiveRecord::BaseWithoutTable
column :name, :string
column :from, :string
column :body, :text
validates_presence_of :name, :from, :body
validates_format_of :from, :with => Post::EMAIL_FORMAT
def send!
if valid?
ContactMailer.deliver_contact_form(self)
else
raise ActiveRecord::RecordInvalid.new(self)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment