Skip to content

Instantly share code, notes, and snippets.

@jfriedlaender
Created August 2, 2011 13:35
Show Gist options
  • Save jfriedlaender/1120189 to your computer and use it in GitHub Desktop.
Save jfriedlaender/1120189 to your computer and use it in GitHub Desktop.
before_save :update_birth_date_fields
private
def update_birth_date_fields
if date_of_birth_changed?
self.birth_month = date_of_birth ? date_of_birth.month : nil
self.birth_day = date_of_birth ? date_of_birth.day : nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment