OSDN Git Service

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