Class: GroupsController
- Inherits:
-
AuthzController
- Object
- ApplicationController
- AuthzController
- GroupsController
- Defined in:
- app/controllers/groups_controller.rb
Overview
TODO: R3 respond_with
Constant Summary collapse
- PER_PAGE =
20
Instance Method Summary collapse
-
#create ⇒ Object
POST /groups POST /groups.xml.
-
#destroy ⇒ Object
DELETE /groups/1 DELETE /groups/1.xml.
- #edit ⇒ Object
-
#index ⇒ Object
GET /groups GET /groups.xml.
-
#new ⇒ Object
GET /groups/new GET /groups/new.xml.
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
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 |
#destroy ⇒ Object
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 |
#edit ⇒ Object
19 20 21 |
# File 'app/controllers/groups_controller.rb', line 19 def edit @group = Group.find(params[:id]) end |
#index ⇒ Object
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 |
#new ⇒ Object
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 |
#show ⇒ Object
33 34 35 |
# File 'app/controllers/groups_controller.rb', line 33 def show @group = Group.find(params[:id]) end |
#update ⇒ Object
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 |