Sha256: 1288b7a3ef8cf342a225d1e03a0fd7dd6ff8cd1a391ddd3c3819d9515da1c2b6
Contents?: true
Size: 915 Bytes
Versions: 2
Compression:
Stored size: 915 Bytes
Contents
module DiscoApp::Admin::Concerns::PlansController extend ActiveSupport::Concern included do before_action :find_plan, only: [:edit, :update] end def index @plans = DiscoApp::Plan.all end def new @plan = DiscoApp::Plan.new @plan.plan_codes.build end def create @plan = DiscoApp::Plan.new(plan_params) if @plan.save redirect_to admin_plans_path else render 'new' end end def edit @plan.plan_codes.build end def update if @plan.update_attributes(plan_params) redirect_to admin_plans_path else render 'edit' end 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 => [:code, :trial_period_days, :amount] ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
disco_app-0.8.8 | app/controllers/disco_app/admin/concerns/plans_controller.rb |
disco_app-0.8.9 | app/controllers/disco_app/admin/concerns/plans_controller.rb |