OSDN Git Service

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