Class: NextSgad::GoalsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- NextSgad::GoalsController
- Defined in:
- app/controllers/next_sgad/goals_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /goals.
-
#destroy ⇒ Object
DELETE /goals/1.
-
#edit ⇒ Object
GET /goals/1/edit.
-
#index ⇒ Object
GET /goals.
-
#new ⇒ Object
GET /goals/new.
-
#show ⇒ Object
GET /goals/1.
-
#update ⇒ Object
PATCH/PUT /goals/1.
Instance Method Details
#create ⇒ Object
POST /goals
26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/next_sgad/goals_controller.rb', line 26 def create @goal = Goal.new(goal_params) if @goal.save redirect_to @goal, notice: 'Goal was successfully created.' else render :new end end |
#destroy ⇒ Object
DELETE /goals/1
46 47 48 49 |
# File 'app/controllers/next_sgad/goals_controller.rb', line 46 def destroy @goal.destroy redirect_to goals_url, notice: 'Goal was successfully destroyed.' end |
#edit ⇒ Object
GET /goals/1/edit
22 23 |
# File 'app/controllers/next_sgad/goals_controller.rb', line 22 def edit end |
#index ⇒ Object
GET /goals
8 9 10 |
# File 'app/controllers/next_sgad/goals_controller.rb', line 8 def index @goals = Goal.all end |
#new ⇒ Object
GET /goals/new
17 18 19 |
# File 'app/controllers/next_sgad/goals_controller.rb', line 17 def new @goal = Goal.new end |
#show ⇒ Object
GET /goals/1
13 14 |
# File 'app/controllers/next_sgad/goals_controller.rb', line 13 def show end |
#update ⇒ Object
PATCH/PUT /goals/1
37 38 39 40 41 42 43 |
# File 'app/controllers/next_sgad/goals_controller.rb', line 37 def update if @goal.update(goal_params) redirect_to @goal, notice: 'Goal was successfully updated.' else render :edit end end |