Skip to content

Instantly share code, notes, and snippets.

@RogerPodacter
Created September 28, 2010 17:41
Show Gist options
  • Select an option

  • Save RogerPodacter/601418 to your computer and use it in GitHub Desktop.

Select an option

Save RogerPodacter/601418 to your computer and use it in GitHub Desktop.
attr_accessor :debtor_fb_id, :creditor_fb_id
before_validation :create_debtor_and_creditor
def create_debtor_and_creditor
self.debtor = User.find_or_create_by_fb_id(debtor_fb_id) if debtor_fb_id
self.creditor = User.find_or_create_by_fb_id(creditor_fb_id) if creditor_fb_id
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment