Help with prev/next links

I've written a Image Gallery app in rails. It contains photo albums, in
which you can upload photos, then click on an individual photo to view
it's larger size. When you bring up the larger size, I have previous and
next buttons to go through the photos in the album. My problem is when
navigating through photos via the next and previous buttons, it scrolls
through ALL photos instead of photos only in that album.

Previous and Next buttons in picture.html.erb

  <section id="prev">
    <%= link_to("Previous", @photo.previous_photo) if
@photo.previous_photo %>

  <section id="next">
    <%= link_to("Next", @photo.next_photo) if @photo.next_photo %>

Methods in model

  def previous_photo
    self.class.first(:conditions => ["id < ?", id], :order => "id desc")

  def next_photo
    self.class.first(:conditions => ["id > ?", id], :order => "id asc")

Method in Albums Controller

  def picture
    @photo = Photo.find(params[:id])

I tried doing it like this:

  <%= link_to("Previous", if %>

  def picture
    @album = Album.find(params[:id])
    @photo = Photo.find(params[:id])

With this result:

  Couldn't find Album with ID=25