OSDN Git Service

create users; add authenticated system
[tdcgexplorer/nimono.git] / app / controllers / pmds_controller.rb
1 class PmdsController < ApplicationController
2   include AuthenticatedSystem
3   layout 'arcs'
4
5   # GET /pmds
6   # GET /pmds.xml
7   def index
8     @search = Pmd::Search.new(params[:search])
9     @pmds = Pmd.paginate(@search.find_options.merge(:page => params[:page], :include => :arc))
10
11     respond_to do |format|
12       format.html # index.html.erb
13       format.xml  { render :xml => @pmds }
14     end
15   end
16
17   # GET /pmds/1
18   # GET /pmds/1.xml
19   def show
20     @pmd = Pmd.find(params[:id])
21
22     respond_to do |format|
23       format.html # show.html.erb
24       format.xml  { render :xml => @pmd }
25     end
26   end
27
28   # GET /pmds/new
29   # GET /pmds/new.xml
30   def new
31     @pmd = Pmd.new
32
33     respond_to do |format|
34       format.html # new.html.erb
35       format.xml  { render :xml => @pmd }
36     end
37   end
38
39   # GET /pmds/1/edit
40   def edit
41     @pmd = Pmd.find(params[:id])
42   end
43
44   # POST /pmds
45   # POST /pmds.xml
46   def create
47     @pmd = Pmd.new(params[:pmd])
48
49     respond_to do |format|
50       if @pmd.save
51         flash[:notice] = 'Pmd was successfully created.'
52         format.html { redirect_to(@pmd) }
53         format.xml  { render :xml => @pmd, :status => :created, :location => @pmd }
54       else
55         format.html { render :action => "new" }
56         format.xml  { render :xml => @pmd.errors, :status => :unprocessable_entity }
57       end
58     end
59   end
60
61   # PUT /pmds/1
62   # PUT /pmds/1.xml
63   def update
64     @pmd = Pmd.find(params[:id])
65
66     respond_to do |format|
67       if @pmd.update_attributes(params[:pmd])
68         flash[:notice] = 'Pmd was successfully updated.'
69         format.html { redirect_to(@pmd) }
70         format.xml  { head :ok }
71       else
72         format.html { render :action => "edit" }
73         format.xml  { render :xml => @pmd.errors, :status => :unprocessable_entity }
74       end
75     end
76   end
77
78   # DELETE /pmds/1
79   # DELETE /pmds/1.xml
80   def destroy
81     @pmd = Pmd.find(params[:id])
82     @pmd.destroy
83
84     respond_to do |format|
85       format.html { redirect_to(pmds_url) }
86       format.xml  { head :ok }
87     end
88   end
89 end