users_controller.rb
来自「用ruby on rails写的一个博客程序,还不错..ruby on rail」· RB 代码 · 共 43 行
RB
43 行
class Admin::UsersController < Admin::BaseController def index list render_action 'list' end def list @users = User.find :all end def show @user = User.find(params[:id], :include => [ :articles ]) @articles = @user.articles end def new @user = User.new(params[:user]) if request.post? and @user.save flash[:notice] = 'User was successfully created.' redirect_to :action => 'list' end end def edit @user = User.find(params[:id]) @user.attributes = params[:user] if request.post? and @user.save flash[:notice] = 'User was successfully updated.' redirect_to :action => 'show', :id => @user.id end end def destroy @user = User.find(params[:id]) if request.post? @user.destroy if User.count > 1 redirect_to :action => 'list' end endend
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?