Class: DiscoApp::SubscriptionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- DiscoApp::SubscriptionsController
- Includes:
- Concerns::AuthenticatedController
- Defined in:
- app/controllers/disco_app/subscriptions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/disco_app/subscriptions_controller.rb', line 10 def create # Get the selected plan. If it's not available or couldn't be found, # redirect back to the plan selection page. if(plan = DiscoApp::Plan.available.find_by_id(subscription_params[:plan])).nil? redirect_to action: :new and return end # Subscribe the current shop to the selected plan. Pass along any cookied # plan code and source code. if(subscription = DiscoApp::SubscriptionService.subscribe(@shop, plan, [DiscoApp::CODE_COOKIE_KEY], [DiscoApp::SOURCE_COOKIE_KEY])).nil? redirect_to action: :new else redirect_to main_app.root_path end end |
#new ⇒ Object
6 7 8 |
# File 'app/controllers/disco_app/subscriptions_controller.rb', line 6 def new @subscription = DiscoApp::Subscription.new end |