Class: ThinkFeelDoDashboard::GroupsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- ThinkFeelDoDashboard::GroupsController
- Defined in:
- app/controllers/think_feel_do_dashboard/groups_controller.rb
Overview
Allows for the creation, updating, and deletion of groups
Instance Method Summary collapse
-
#create ⇒ Object
POST /think_feel_do_dashboard/groups.
-
#destroy ⇒ Object
DELETE /think_feel_do_dashboard/groups/1.
-
#edit ⇒ Object
GET /think_feel_do_dashboard/groups/1/edit.
-
#index ⇒ Object
GET /think_feel_do_dashboard/groups.
-
#new ⇒ Object
GET /think_feel_do_dashboard/groups/new.
-
#show ⇒ Object
GET /think_feel_do_dashboard/groups/1.
-
#update ⇒ Object
PATCH/PUT /think_feel_do_dashboard/groups/1.
Instance Method Details
#create ⇒ Object
POST /think_feel_do_dashboard/groups
18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/think_feel_do_dashboard/groups_controller.rb', line 18 def create @group = Group.new(group_params.except(:user_id)) :create, @group if @group.save redirect_to @group, notice: "Group was successfully created." else render :new end end |
#destroy ⇒ Object
DELETE /think_feel_do_dashboard/groups/1
59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/think_feel_do_dashboard/groups_controller.rb', line 59 def destroy :destroy, @group @group.destroy response_status = { notice: "Group was successfully destroyed." } rescue ActiveRecord::DeleteRestrictionError => e response_status = { alert: e. } ensure redirect_to groups_url, response_status end |
#edit ⇒ Object
GET /think_feel_do_dashboard/groups/1/edit
42 43 44 |
# File 'app/controllers/think_feel_do_dashboard/groups_controller.rb', line 42 def edit :edit, @group end |
#index ⇒ Object
GET /think_feel_do_dashboard/groups
12 13 14 15 |
# File 'app/controllers/think_feel_do_dashboard/groups_controller.rb', line 12 def index :index, Group @groups = Group.all end |
#new ⇒ Object
GET /think_feel_do_dashboard/groups/new
31 32 33 34 |
# File 'app/controllers/think_feel_do_dashboard/groups_controller.rb', line 31 def new :new, Group @group = Group.new end |
#show ⇒ Object
GET /think_feel_do_dashboard/groups/1
37 38 39 |
# File 'app/controllers/think_feel_do_dashboard/groups_controller.rb', line 37 def show :show, @group end |
#update ⇒ Object
PATCH/PUT /think_feel_do_dashboard/groups/1
47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/think_feel_do_dashboard/groups_controller.rb', line 47 def update :update, @group if @group.update(group_params.except(:user_id)) redirect_to group_path(@group), notice: "Group was successfully updated.", only: true else render :edit end end |