All pastes #22206 Raw Edit

tonyc

public ruby v1 · immutable
#22206 ·published 2005-09-06 01:51 UTC
rendered paste body
class NewsController < ApplicationController  layout "greymarket"  def index    @posts = Post.recent(10)  end    def show    @post = Post.find(params[:id])  end    def comment        @post = Post.find(params[:id])    @comment = Comment.new(params[:comment])    @post.comments << @comment        if @post.save      flash[:notice] = "Comment saved successfully"    else      flash[:notice] = "There were #{@comment.errors.count} errors when saving the comment."    end        render :action => "show", :id => @post.id  endend