Skip to content

Instantly share code, notes, and snippets.

@hidenba
Created July 28, 2010 15:32
Show Gist options
  • Save hidenba/494909 to your computer and use it in GitHub Desktop.
Save hidenba/494909 to your computer and use it in GitHub Desktop.
class Person
include ActiveModel::Validations
attr_accessor :age,:name
validates_presence_of :name
def initialize(attr = {})
attr.each { |n, v| send("#{n}=", v)}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment