Class: GraphStarter::GroupsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- GraphStarter::GroupsController
- Defined in:
- app/controllers/graph_starter/groups_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /groups POST /groups.json.
-
#destroy ⇒ Object
DELETE /groups/1 DELETE /groups/1.json.
-
#edit ⇒ Object
GET /groups/1/edit.
-
#index ⇒ Object
GET /groups GET /groups.json.
-
#new ⇒ Object
GET /groups/new.
-
#show ⇒ Object
GET /groups/1 GET /groups/1.json.
-
#update ⇒ Object
PATCH/PUT /groups/1 PATCH/PUT /groups/1.json.
- #users_to_add ⇒ Object
Instance Method Details
#create ⇒ Object
POST /groups POST /groups.json
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/graph_starter/groups_controller.rb', line 29 def create @group = Group.new(group_params) respond_to do |format| if @group.save format.html { redirect_to @group, notice: 'Group was successfully created.' } format.json { render :show, status: :created, location: @group } else format.html { render :new } format.json { render json: @group.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /groups/1 DELETE /groups/1.json
59 60 61 62 63 64 65 |
# File 'app/controllers/graph_starter/groups_controller.rb', line 59 def destroy @group.destroy respond_to do |format| format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /groups/1/edit
24 25 |
# File 'app/controllers/graph_starter/groups_controller.rb', line 24 def edit end |
#index ⇒ Object
GET /groups GET /groups.json
9 10 11 |
# File 'app/controllers/graph_starter/groups_controller.rb', line 9 def index @groups = Group.roots end |
#new ⇒ Object
GET /groups/new
19 20 21 |
# File 'app/controllers/graph_starter/groups_controller.rb', line 19 def new @group = Group.new end |
#show ⇒ Object
GET /groups/1 GET /groups/1.json
15 16 |
# File 'app/controllers/graph_starter/groups_controller.rb', line 15 def show end |
#update ⇒ Object
PATCH/PUT /groups/1 PATCH/PUT /groups/1.json
45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/graph_starter/groups_controller.rb', line 45 def update respond_to do |format| if @group.update(group_params) format.html { redirect_to @group, notice: 'Group was successfully updated.' } format.json { render :show, status: :ok, location: @group } else format.html { render :edit } format.json { render json: @group.errors, status: :unprocessable_entity } end end end |
#users_to_add ⇒ Object
67 68 69 |
# File 'app/controllers/graph_starter/groups_controller.rb', line 67 def users_to_add render json: @group.addable_users end |