All pastes #234906 Raw Edit

Someone

public ruby v1 · immutable
·published 2006-11-02 22:04 UTC
rendered paste body
class WebsiteController < ApplicationController        def index                redirect_to :action => :list        end        def list                @websites = Website.find(:all, :conditions => ["is_approved = 1"])        end        def show                @website  = Website.find_by_id(params[:id], :conditions => ["is_approved = 1"])                return redirect_to :action => :list if @website.nil?                @next_website = @website.next()                @prev_website = @website.prev()                @comments = @website.comments.find(:all)                @ratings  = @website.rating        end        def create                if request.post?                        @website = Website.create(params[:website])                        if @website.save                                redirect_to :action => :show, :id => @website[:id]                        end                        notice = []                        @website.errors.each {|k, error| notice << [error] }                        @flash[:notice] = notice.join("<br />")                        redirect_to :action => :list                end        endendr