Class: NextSgad::GoalsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/next_sgad/goals_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

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

#destroyObject

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

#editObject

GET /goals/1/edit



22
23
# File 'app/controllers/next_sgad/goals_controller.rb', line 22

def edit
end

#indexObject

GET /goals



8
9
10
# File 'app/controllers/next_sgad/goals_controller.rb', line 8

def index
  @goals = Goal.all
end

#newObject

GET /goals/new



17
18
19
# File 'app/controllers/next_sgad/goals_controller.rb', line 17

def new
  @goal = Goal.new
end

#showObject

GET /goals/1



13
14
# File 'app/controllers/next_sgad/goals_controller.rb', line 13

def show
end

#updateObject

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