item_controller.rb
来自「RubyonRailsC.zip ruby on rails的源码」· RB 代码 · 共 27 行
RB
27 行
class ItemController < ApplicationController
scaffold :item
def create
@item = Item.new(@params['item'])
@item.date = Date.today
if @item.save
redirect_to :action =>'list'
else
render_action 'new'
end
end
def new
@items = Item.new
@categories = Category.find_all
end
def list
@items = Item.find_all
end
def edit
@item = Item.find(@params["id"])
@categories = Category.find_all
endend
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?