Class: NextSgad::ActivitiesController

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

Instance Method Summary collapse

Instance Method Details

#createObject

POST /activities



27
28
29
30
31
32
33
34
35
# File 'app/controllers/next_sgad/activities_controller.rb', line 27

def create
  @activity = Activity.new(activity_params)

  if @activity.save
    redirect_to @activity, notice: 'Activity was successfully created.'
  else
    render :new
  end
end

#destroyObject

DELETE /activities/1



47
48
49
50
# File 'app/controllers/next_sgad/activities_controller.rb', line 47

def destroy
  @activity.destroy
  redirect_to activities_url, notice: 'Activity was successfully destroyed.'
end

#editObject

GET /activities/1/edit



23
24
# File 'app/controllers/next_sgad/activities_controller.rb', line 23

def edit
end

#indexObject

GET /activities



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

def index
  @activities = Activity.all
end

#newObject

GET /activities/new



18
19
20
# File 'app/controllers/next_sgad/activities_controller.rb', line 18

def new
  @activity = Activity.new
end

#showObject

GET /activities/1



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

def show
end

#updateObject

PATCH/PUT /activities/1



38
39
40
41
42
43
44
# File 'app/controllers/next_sgad/activities_controller.rb', line 38

def update
  if @activity.update(activity_params)
    redirect_to @activity, notice: 'Activity was successfully updated.'
  else
    render :edit
  end
end