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
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/disco_app/subscriptions_controller.rb', line 11 def create # Get the selected plan. If it's not available or couldn't be found, # redirect back to the plan selection page. plan = DiscoApp::Plan.available.find_by(id: subscription_params[:plan]) redirect_to(action: :new) && return unless plan # Subscribe the current shop to the selected plan. Pass along any cookied # plan code and source code. subscription = DiscoApp::SubscriptionService.subscribe( @shop, plan, [DiscoApp::CODE_COOKIE_KEY], [DiscoApp::SOURCE_COOKIE_KEY] ) if subscription.nil? redirect_to action: :new else redirect_to main_app.root_path end end |
#new ⇒ Object
7 8 9 |
# File 'app/controllers/disco_app/subscriptions_controller.rb', line 7 def new @subscription = DiscoApp::Subscription.new end |