diff options
Diffstat (limited to 'billing/app/controllers')
-rw-r--r-- | billing/app/controllers/customers_controller.rb | 3 | ||||
-rw-r--r-- | billing/app/controllers/subscriptions_controller.rb | 7 |
2 files changed, 7 insertions, 3 deletions
diff --git a/billing/app/controllers/customers_controller.rb b/billing/app/controllers/customers_controller.rb index 3479448..b0184af 100644 --- a/billing/app/controllers/customers_controller.rb +++ b/billing/app/controllers/customers_controller.rb @@ -4,8 +4,7 @@ class CustomersController < BillingBaseController def show - @subscriptions = @customer.active_subscriptions(@braintree_data) - + @active_subscription = @customer.subscriptions(@braintree_data) # UGLY Braintree::ResourceCollection to array. # might want method @transactions = [] diff --git a/billing/app/controllers/subscriptions_controller.rb b/billing/app/controllers/subscriptions_controller.rb index b248be5..9217979 100644 --- a/billing/app/controllers/subscriptions_controller.rb +++ b/billing/app/controllers/subscriptions_controller.rb @@ -6,7 +6,7 @@ class SubscriptionsController < ApplicationController # don't show link to subscribe if they are already subscribed? customer = Customer.find_by_user_id(current_user.id) - if subscription = customer.single_subscription + if subscription = customer.subscriptions # will return active subscription, if it exists redirect_to subscription_path(subscription.id), :notice => 'You already have an active subscription' else credit_card = customer.default_credit_card #safe to assume default? @@ -25,6 +25,11 @@ class SubscriptionsController < ApplicationController @result = Braintree::Subscription.cancel params[:id] end + def index + customer = Customer.find_by_user_id(current_user.id) + @subscriptions = customer.subscriptions(nil, false) + end + private def fetch_subscription |