Skip to content

Instantly share code, notes, and snippets.

@jfriedlaender
Created August 30, 2011 14:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfriedlaender/1181005 to your computer and use it in GitHub Desktop.
Save jfriedlaender/1181005 to your computer and use it in GitHub Desktop.
def subscription_state_change
begin
account = Account.find(@subscription.customer.reference)
account.subscription_state = @subscription.state
account.subscription_billing_date = @subscription.current_period_ends_at
account.save(:validate => false)
render :nothing => true, :status => 200
rescue Exception => e
notify_hoptoad(e) #If you use hoptoad...
render :nothing => true, :status => 422 and return
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment