You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 16, 2018. It is now read-only.
Nate Welling edited this page Aug 9, 2017
·
1 revision
1. First you need to define the path in your <plan_class> model
# app/models/<plan_class>.rbdefredirect_path(subscription)# you can return any path here, possibly referencing the given subscription# config path in routes.rb, example: get "thanks", to: "<plan_class>#thanks", as: :thanks"/thanks"end
2. Then in the controller, you can configure the redirect paths
# app/controllers/<plan_class>_controller.rbdefthanksflash.now[:success]="<plan_class> signup successful."ifcurrent_member.subscriptions.active.any?@subscription=current_member.subscriptions.active.firstif(@subscription.cancel_at_period_end? || @subscription.canceled_at?)flash[:error]="<plan_class> has been canceled."redirect_toroot_pathendelseflash[:error]="You do not have access."redirect_back(fallback_location: (request.referer || root_path))endend