class TeamsController
Team administration: named groups of users. Full CRUD is admin-only.
Public Instance Methods
Source
# File app/controllers/teams_controller.rb, line 21 def create @team = Team.new(team_params) authorize @team if @team.save redirect_to team_path(@team), notice: t("teams.notices.created") else render :new, status: :unprocessable_content end end
Source
# File app/controllers/teams_controller.rb, line 44 def destroy authorize @team @team.destroy! redirect_to teams_path, notice: t("teams.notices.destroyed") end
Source
# File app/controllers/teams_controller.rb, line 6 def index authorize Team @teams = Team.order(:name) end
Lists every team with its member count.
Source
# File app/controllers/teams_controller.rb, line 16 def new @team = Team.new authorize @team end
Source
# File app/controllers/teams_controller.rb, line 12 def show authorize @team end
Shows one team and its members.
Source
# File app/controllers/teams_controller.rb, line 35 def update authorize @team if @team.update(team_params) redirect_to team_path(@team), notice: t("teams.notices.updated") else render :edit, status: :unprocessable_content end end