Sha256: cbf00eb08840afb10467e6510f54d11f813d87c8c01a9f71a24301c8accbb066
Contents?: true
Size: 970 Bytes
Versions: 46
Compression:
Stored size: 970 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_attributes(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 => [:id, :_destroy, :code, :trial_period_days, :amount] ) end end
Version data entries
46 entries across 46 versions & 1 rubygems