Class: GroupsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/groups_controller.rb

Instance Attribute Summary

Attributes inherited from ApplicationController

#current_user, #current_user Used for unit testing, this is normally managed by Devise

Instance Method Summary collapse

Methods inherited from ApplicationController

#clear_search_index, #search_params

Instance Method Details

#createObject



37
38
39
40
41
42
43
44
45
# File 'app/controllers/groups_controller.rb', line 37

def create
  @group = Group.new(group_params)

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

#destroyObject



60
61
62
63
# File 'app/controllers/groups_controller.rb', line 60

def destroy
  @group.destroy
  redirect_to groups_url, notice: 'Group was successfully destroyed.'
end

#editObject

GET /groups/1/edit



31
32
# File 'app/controllers/groups_controller.rb', line 31

def edit
end

#indexObject



16
17
18
# File 'app/controllers/groups_controller.rb', line 16

def index
  @groups = Group.all
end

#newObject

GET /groups/new



26
27
28
# File 'app/controllers/groups_controller.rb', line 26

def new
  @group = Group.new
end

#showObject



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

def show
end

#updateObject



50
51
52
53
54
55
56
# File 'app/controllers/groups_controller.rb', line 50

def update
  if @group.update(group_params)
    redirect_to @group, notice: 'Group was successfully updated.'
  else
    render :edit
  end
end