trackbacks_controller.rb

来自「用ruby on rails写的一个博客程序,还不错..ruby on rail」· RB 代码 · 共 55 行

RB
55
字号
class Admin::TrackbacksController < Admin::BaseController  before_filter :get_article  def index    list    render_action 'list'  end  def list    @trackbacks = @article.trackbacks.find(:all, :order => "id DESC")  end  def show    @trackback = @article.trackbacks.find(params[:id])  end  def new    @trackback = @article.trackbacks.build(params[:trackback])    if request.post? and @trackback.save      flash[:notice] = 'Trackback was successfully created.'      redirect_to :action => 'show', :id => @trackback.id    end  end  def edit    @trackback = @article.trackbacks.find(params[:id])    @trackback.attributes = params[:trackback]    if request.post? and @trackback.save      flash[:notice] = 'Trackback was successfully updated.'      redirect_to :action => 'show', :id => @trackback.id    end  end  def destroy    @trackback = @article.trackbacks.find(params[:id])    if request.post?      @trackback.destroy      redirect_to :action => 'list'    end  end  private    def get_article      @article = Article.find(params[:article_id])      if @article.nil?        redirect_to '/admin'      end    endend

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?