Skip to content

Instantly share code, notes, and snippets.

@amiel
Created November 10, 2011 19:27
Show Gist options
  • Save amiel/1355870 to your computer and use it in GitHub Desktop.
Save amiel/1355870 to your computer and use it in GitHub Desktop.
PROTIP
# Instead of this
after_create :advance_plan
def advance_plan
plan.advance if plan
end
# Or this
after_create :advance_plan
def advance_plan
plan.try :advance
end
# Try this, be assertive
after_create :advance_plan, :if => :plan
def advance_plan
plan.advance
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment