Skip to content

Instantly share code, notes, and snippets.

@filkinsteez
Created December 14, 2013 18:44
Show Gist options
  • Save filkinsteez/7963185 to your computer and use it in GitHub Desktop.
Save filkinsteez/7963185 to your computer and use it in GitHub Desktop.
message class
class Message
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attr_accessor :name, :email, :subject, :body
validates :name, :email, :subject, :body, :presence => true
validates :email, :format => { :with => %r{.+@.+\..+} }, :allow_blank => true
def initialize(attributes = {})
attributes.each do |name, value|
send("#{name}=", value)
end
end
def persisted?
false
end
def currentpatient
true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment