Created
July 22, 2011 14:05
-
-
Save shayfrendt/1099512 to your computer and use it in GitHub Desktop.
Sample Chargify Post-Back Controller
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
class Chargify::SubscriptionsController < ApplicationController | |
def update | |
subscription_ids = params['_json'] | |
#Rails.logger.debug("SUB IDS: #{subscription_ids.inspect}") | |
begin | |
subscription_ids.each do |id| | |
# Process updated subscriptions here | |
Rails.logger.debug("SUB ID: #{id}") | |
end | |
respond_to do |format| | |
format.json { head :ok } | |
end | |
rescue # watch out, this will rescue everything! You may want to be more selective... | |
respond_to do |format| | |
format.json { head :internal_server_error } | |
end | |
end | |
end | |
end | |
# suggested corresponding named route for routes.rb | |
# map.chargify_subscriptions '/chargify/subscriptions/:action.:format', :controller => 'chargify/subscriptions' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment