app/controllers/clipster/clips_controller.rb
def show
      @clip = Clip.where("id = :id and (expires is null OR expires > :now)",{
          :id => params[:id],
          :now => DateTime.now
      }).first

      if @clip.nil?
        # Most likely the clip is expired, take advantage of this time to
        # clean up all expired clips, then display error page
        Clip.delete_expired
        respond_to do |format|
          @clip = Clip.new
          @clip.errors.add("Clip id", "is either invalid or it has expired.")
          format.html { render :expired, status: :not_found }
          format.text { render text: @clip.errors, status: :not_found }
          format.json { render json: @clip.errors, status: :not_found }
          format.xml { render xml: @clip.errors, status: :not_found }
        end
        return
      end

      respond_to do |format|
        format.html
        format.text { render text: @clip.clip.html_safe }
        format.json { render json: @clip }
        format.xml { render xml: @clip }
      end
    end
def show
      @clip = Clip.where("id = :id and (expires is null OR expires > :now)",{
          :id => params[:id],
          :now => DateTime.now
      }).first

      if @clip.nil?
        # Most likely the clip is expired, take advantage of this time to
        # clean up all expired clips, then display error page
        Clip.delete_expired
        respond_to do |format|
          @clip = Clip.new
          @clip.errors.add("Clip id", "is either invalid or it has expired.")
          format.html { render :expired, status: :not_found }
          format.text { render text: @clip.errors, status: :not_found }
          format.json { render json: @clip.errors, status: :not_found }
          format.xml { render xml: @clip.errors, status: :not_found }
        end
        return
      end

      respond_to do |format|
        format.html
        format.text { render text: @clip.clip.html_safe }
        format.json { render json: @clip }
        format.xml { render xml: @clip }
      end
    end
POST /[id]
 POST /[id].json
 POST /[id].xml