Class: SimpleTeams::TeamsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SimpleTeams::TeamsController
- Defined in:
- app/controllers/simple_teams/teams_controller.rb,
app/controllers/simple_teams/admin/teams_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /teams.
-
#destroy ⇒ Object
DELETE /teams/1.
-
#edit ⇒ Object
GET /teams/1/edit.
-
#index ⇒ Object
GET /teams.
-
#new ⇒ Object
GET /teams/new.
-
#show ⇒ Object
GET /teams/1.
-
#update ⇒ Object
PATCH/PUT /teams/1.
Instance Method Details
#create ⇒ Object
POST /teams
24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/simple_teams/admin/teams_controller.rb', line 24 def create @team = Team.new(team_params) if @team.save redirect_to @team, notice: "Team was successfully created." else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
DELETE /teams/1
44 45 46 47 |
# File 'app/controllers/simple_teams/admin/teams_controller.rb', line 44 def destroy @team.destroy redirect_to teams_url, notice: "Team was successfully destroyed.", status: :see_other end |
#edit ⇒ Object
GET /teams/1/edit
20 21 |
# File 'app/controllers/simple_teams/admin/teams_controller.rb', line 20 def edit end |
#index ⇒ Object
GET /teams
6 7 8 |
# File 'app/controllers/simple_teams/admin/teams_controller.rb', line 6 def index @teams = Team.all end |
#new ⇒ Object
GET /teams/new
15 16 17 |
# File 'app/controllers/simple_teams/admin/teams_controller.rb', line 15 def new @team = Team.new end |
#show ⇒ Object
GET /teams/1
11 12 13 14 15 16 |
# File 'app/controllers/simple_teams/admin/teams_controller.rb', line 11 def show :read, @team @memberships = @team.memberships.joins(:member).order(:first_name) @invitations = @team.invitations.initial.order(:email) @memberships_and_invitations = @memberships.to_a + @invitations.to_a end |
#update ⇒ Object
PATCH/PUT /teams/1
35 36 37 38 39 40 41 |
# File 'app/controllers/simple_teams/admin/teams_controller.rb', line 35 def update if @team.update(team_params) redirect_to @team, notice: "Team was successfully updated.", status: :see_other else render :edit, status: :unprocessable_entity end end |