dave99s_controller.rb
来自「ruby on rails web敏捷开发之路第二版 源代码」· RB 代码 · 共 85 行
RB
85 行
#---# Excerpted from "Agile Web Development with Rails, 2nd Ed."# We make no guarantees that this code is fit for any purpose. # Visit http://www.pragmaticprogrammer.com/titles/rails2 for more book information.#---class Dave99sController < ApplicationController # GET /dave99s # GET /dave99s.xml def index @dave99s = Dave99.find(:all) respond_to do |format| format.html # index.rhtml format.xml { render :xml => @dave99s.to_xml } end end # GET /dave99s/1 # GET /dave99s/1.xml def show @dave99 = Dave99.find(params[:id]) respond_to do |format| format.html # show.rhtml format.xml { render :xml => @dave99.to_xml } end end # GET /dave99s/new def new @dave99 = Dave99.new end # GET /dave99s/1;edit def edit @dave99 = Dave99.find(params[:id]) end # POST /dave99s # POST /dave99s.xml def create @dave99 = Dave99.new(params[:dave99]) respond_to do |format| if @dave99.save flash[:notice] = 'Dave99 was successfully created.' format.html { redirect_to dave99_path(@dave99) } format.xml { head :created, :location => dave99_path(@dave99) } else format.html { render :action => "new" } format.xml { render :xml => @dave99.errors.to_xml } end end end # PUT /dave99s/1 # PUT /dave99s/1.xml def update @dave99 = Dave99.find(params[:id]) respond_to do |format| if @dave99.update_attributes(params[:dave99]) flash[:notice] = 'Dave99 was successfully updated.' format.html { redirect_to dave99_path(@dave99) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @dave99.errors.to_xml } end end end # DELETE /dave99s/1 # DELETE /dave99s/1.xml def destroy @dave99 = Dave99.find(params[:id]) @dave99.destroy respond_to do |format| format.html { redirect_to dave99s_path } format.xml { head :ok } end endend
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?