MaD wrote:
> two suggestions:
> 1. set a debugger at the beginning of you show-method. that way you
> will find the reason for @photo being nil.
> 2. since Photo.id is your primary key (and therefore unique) you could
> just do your find like this:
>   @photo = Photo.find(params[:id])
> instead of the much longer:
>   @photo = Photo.find_by_user_id_and_id(params[:user_id], params
> [:id], :include => :user)
> as long as id distinctly identifies the record the user_id doesn't
> matter

The above method doesnt work. Any other solutions? Does it got to do 
with my photo controller?

class PhotosController < ApplicationController
  def index
    photos_count = Photo.count(:conditions => 'thumbnail IS NULL')
    @photo_pages = Paginator.new(self, photos_count, 9, params[:page])
    @photos = Photo.find(:all,
                         :conditions => 'thumbnail IS NULL',
                         :order => 'created_at DESC',
                         :limit => @photo_pages.items_per_page,
                         :offset => @photo_pages.current.offset)
  end
end
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to