Displaying 1 result from an estimated 1 matches for "find_most_rec".
2006 Jun 08
1
Error Handling Question
...method for the PhotoController
and need to tell the application what to do when a photo cannot be
found with the specified id:
class PhotoController < ApplicationController
def show
if params[:id].nil?
#Take the user to the index page of the most recent photo.
@photo = Photo.find_most_recent
else
#Show a photo with a specified id
if @photo = Photo.find(params[:id], :conditions =>
"publishing_time <= now()")
else
#Attempt to send them to the most recent post with a flash[:warning]
flash[:warning] = ''No published photo exi...