Sha256: 398830f8cb1448ae5b3d2abc57782feeaacc762ceed33b2ad53e6ef0f4f8c1f4
Contents?: true
Size: 953 Bytes
Versions: 4
Compression:
Stored size: 953 Bytes
Contents
module Admin class CoachesController < Fae::BaseController before_action :set_parent_context def index @items = @klass.where(team_id: params[:team_id]).order(:first_name) end def create @item = @klass.new(item_params) @item.team_id = params[:team_id] if @item.save redirect_to @index_path, notice: t('fae.save_notice') else render action: 'new', error: t('fae.save_error') end end private def set_parent_context @parent_item = Team.find(params[:team_id]) @klass_humanized = "#{@parent_item.name} Coach" @index_path = admin_team_coaches_path(@parent_item) @new_path = new_admin_team_coach_path(@parent_item) end # Use callbacks to share common setup or constraints between actions. def set_item @item = @klass.where(team_id: params[:team_id]).find(params[:id]) end def use_pagination true end end end
Version data entries
4 entries across 4 versions & 1 rubygems