@Bobnation:

Thanks - this is also what I take home from the error message - I just 
don't understand where the user for a photo should be instantiated. In 
my photos_controller, I have

@photos = Photo.paginate_by_sql ['select * from photos'],
                         :page => params[:page],
                         :per_page => 10

this uses will_paginate and it fails like I described in the first post. 
However if I switch to this:

#old controller, uses classic_pagination
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
                         )

Then the photos and the generated urls work fine, but the pagination 
links don't.

/ Vahagn


Bobnation wrote:
> Looking at the error message, it seems to be saying that user_id is
> nil ... which tells me that you don't have a user set for that photo
> and it can't generate the URL without knowing the id of the user.
> 
> On Oct 28, 5:48�am, Vahagn Hayrapetyan <[EMAIL PROTECTED]

-- 
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