Skip to content

Instantly share code, notes, and snippets.

@rgo
Created July 6, 2009 14:59
Show Gist options
  • Save rgo/141472 to your computer and use it in GitHub Desktop.
Save rgo/141472 to your computer and use it in GitHub Desktop.
class Contact
include Validateable
attr_accessor :name,:phone, :email, :body
def initialize(options = {})
unless options.nil?
@name = options[:name] if options[:name]
@email = options[:email] if options[:email]
@phone = options[:phone] if options[:phone]
@body = options[:body] if options[:body]
end
end
validates_presence_of :name
validates_presence_of :phone
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment