Class: GroupsController

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

Overview

TODO: R3 respond_with

Constant Summary collapse

PER_PAGE =
20

Instance Method Summary collapse

Instance Method Details

#createObject

POST /groups POST /groups.xml



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'app/controllers/groups_controller.rb', line 50

def create
  @group = Group.new(params[:group])

  respond_to do |format|
    if @group.save
      flash[:notice] = 'Group was successfully created.'
      format.html { redirect_to(groups_path) }
      format.xml  { render :xml => @group, :status => :created, :location => @group }
    else
      format.html { render :action => "new" }
      format.xml  { render :xml => @group.errors, :status => :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /groups/1 DELETE /groups/1.xml



67
68
69
70
71
72
73
74
75
# File 'app/controllers/groups_controller.rb', line 67

def destroy
  @group = Group.find(params[:id])
  @group.destroy

  respond_to do |format|
    format.html { redirect_to(groups_url) }
    format.xml  { head :ok }
  end
end

#editObject



19
20
21
# File 'app/controllers/groups_controller.rb', line 19

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

#indexObject

GET /groups GET /groups.xml



10
11
12
13
14
15
16
17
# File 'app/controllers/groups_controller.rb', line 10

def index
  @groups = Group.all

  respond_to do |format|
    format.html # index.html.erb
    format.xml  { render :xml => @groups }
  end
end

#newObject

GET /groups/new GET /groups/new.xml



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

def new
  @group = Group.new

  respond_to do |format|
    format.html # new.html.erb
    format.xml  { render :xml => @group }
  end
end

#showObject



33
34
35
# File 'app/controllers/groups_controller.rb', line 33

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

#updateObject



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

def update
  @group = Group.find(params[:id])
  if @group.update_attributes(params[:group])
    flash[:notice] = 'Group was successfully updated.'
    redirect_to(@group)
  else
    render :action => "edit"
  end
end