Sha256: a7a3bc91f02c78fcae3c5cfa8989d46f960b063278b9e8ac8c9064b7c4890496
Contents?: true
Size: 950 Bytes
Versions: 7
Compression:
Stored size: 950 Bytes
Contents
module DiscoApp::Admin::Concerns::PlansController extend ActiveSupport::Concern included do before_action :find_plan, only: [:edit, :update, :destroy] end def index @plans = DiscoApp::Plan.all end def new @plan = DiscoApp::Plan.new end def create @plan = DiscoApp::Plan.new(plan_params) if @plan.save redirect_to admin_plans_path else render 'new' end end def edit end def update if @plan.update(plan_params) redirect_to edit_admin_plan_path(@plan) else render 'edit' end end def destroy @plan.destroy redirect_to admin_plans_path end private def find_plan @plan = DiscoApp::Plan.find(params[:id]) end def plan_params params.require(:plan).permit( :name, :status, :plan_type, :trial_period_days, :amount, plan_codes_attributes: %i[id _destroy code trial_period_days amount] ) end end
Version data entries
7 entries across 7 versions & 1 rubygems