Skip to content

Instantly share code, notes, and snippets.

@jacaetevha
Created August 9, 2012 14:18
Show Gist options
  • Select an option

  • Save jacaetevha/3304568 to your computer and use it in GitHub Desktop.

Select an option

Save jacaetevha/3304568 to your computer and use it in GitHub Desktop.
add_person = ->(person) {
return [nil,"Name is required"] if String(person.(:name)) == ''
return [nil,"Birthdate is required"] if String(person.(:birthdate)) == ''
return [nil,"Gender is required"] if String(person.(:gender)) == ''
return [nil,"Gender must be 'male' or 'female'"] if person.(:gender) != 'male' &&
person.(:gender) != 'female'
id = insert_person.(person.(:name),person.(:birthdate),person.(:gender),person.(:title))
# [new_person.(:with_id,id),nil] # <====
[person.(:with_id,id),nil] # <==== I think it should be this. Right?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment