root/app/controllers/test1s_controller.rb @ 3

Revision 1, 1.9 kB (checked in by falcon, 17 years ago)

Version one -> initial work from the laptop.

Line 
1class Test1sController < ApplicationController
2  # GET /test1s
3  # GET /test1s.xml
4  def index
5    @test1s = Test1.find(:all)
6
7    respond_to do |format|
8      format.html # index.html.erb
9      format.xml  { render :xml => @test1s }
10    end
11  end
12
13  # GET /test1s/1
14  # GET /test1s/1.xml
15  def show
16    @test1 = Test1.find(params[:id])
17
18    respond_to do |format|
19      format.html # show.html.erb
20      format.xml  { render :xml => @test1 }
21    end
22  end
23
24  # GET /test1s/new
25  # GET /test1s/new.xml
26  def new
27    @test1 = Test1.new
28
29    respond_to do |format|
30      format.html # new.html.erb
31      format.xml  { render :xml => @test1 }
32    end
33  end
34
35  # GET /test1s/1/edit
36  def edit
37    @test1 = Test1.find(params[:id])
38  end
39
40  # POST /test1s
41  # POST /test1s.xml
42  def create
43    @test1 = Test1.new(params[:test1])
44
45    respond_to do |format|
46      if @test1.save
47        flash[:notice] = 'Test1 was successfully created.'
48        format.html { redirect_to(@test1) }
49        format.xml  { render :xml => @test1, :status => :created, :location => @test1 }
50      else
51        format.html { render :action => "new" }
52        format.xml  { render :xml => @test1.errors, :status => :unprocessable_entity }
53      end
54    end
55  end
56
57  # PUT /test1s/1
58  # PUT /test1s/1.xml
59  def update
60    @test1 = Test1.find(params[:id])
61
62    respond_to do |format|
63      if @test1.update_attributes(params[:test1])
64        flash[:notice] = 'Test1 was successfully updated.'
65        format.html { redirect_to(@test1) }
66        format.xml  { head :ok }
67      else
68        format.html { render :action => "edit" }
69        format.xml  { render :xml => @test1.errors, :status => :unprocessable_entity }
70      end
71    end
72  end
73
74  # DELETE /test1s/1
75  # DELETE /test1s/1.xml
76  def destroy
77    @test1 = Test1.find(params[:id])
78    @test1.destroy
79
80    respond_to do |format|
81      format.html { redirect_to(test1s_url) }
82      format.xml  { head :ok }
83    end
84  end
85end
Note: See TracBrowser for help on using the browser.