Sha256: e8bdad172ae356d3d61527a817c605c484eb03ada45a12daf3cdf856d2bcd9c1
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
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 def build_assets @item.build_image if @item.image.blank? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fae-rails-1.6.0 | spec/dummy/app/controllers/admin/coaches_controller.rb |