Class: Admin::GroupsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/amalgam/admin/groups_controller.rb

Instance Method Summary collapse

Instance Method Details

#create ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/controllers/amalgam/admin/groups_controller.rb', line 33

def create
  @group = Amalgam::Models::Group.new(params[:group])
  respond_to do |format|
    format.html do
      if @group.save
        redirect_to admin_groups_path
      else
        render 'new'
      end
    end
  end
end

#destroy ⇒ Object



46
47
48
49
50
51
52
# File 'app/controllers/amalgam/admin/groups_controller.rb', line 46

def destroy
  @group = Amalgam::Models::Group.find(params[:id])
  @group.destroy
  respond_to do |format|
    format.html{ redirect_to admin_groups_path}
  end
end

#edit ⇒ Object



8
9
10
# File 'app/controllers/amalgam/admin/groups_controller.rb', line 8

def edit
  @group = Amalgam::Models::Group.find(params[:id])
end

#index ⇒ Object



4
5
6
# File 'app/controllers/amalgam/admin/groups_controller.rb', line 4

def index
  @groups = Amalgam::Models::Group.all
end

#new ⇒ Object



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

def new
  @group = Amalgam::Models::Group.new
end

#show ⇒ Object



12
13
14
# File 'app/controllers/amalgam/admin/groups_controller.rb', line 12

def show
  @group = Amalgam::Models::Group.find(params[:id])
end

#update ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/amalgam/admin/groups_controller.rb', line 20

def update
  @group = Amalgam::Models::Group.find(params[:id])
  respond_to do |format|
    format.html do
      if @group.update_attributes(params[:group])
        redirect_to admin_groups_path
      else
        render 'edit'
      end
    end
  end
end