Created
August 30, 2011 14:22
-
-
Save jfriedlaender/1181005 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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