MaD wrote:
> well, the error-message is pretty clear:
>> The error occurred while evaluating nil.user
>> 2: � <%= link_to "#[email protected]}'s Photos",
> 
> @photo seems to be nil. the reason for it can be found in your
> controller (where show is defined).


I still have no clue at all as I follow the code from the book. The 
application trace state that the "respond to do |format|" in the show 
method has something wrong.

Below is controller where show is defined:

Class UserPhotosController < ApplicationController
  before_filter :login_required, :except => [:index, :show]

  def index
    @user = User.find(params[:user_id])
    @photo_pages = Paginator.new(self, @user.photos.count, 9, 
params[:page])
    @photos = @user.photos.find(:all, :order => 'created_at DESC',
                                      :limit => 
@photo_pages.items_per_page,
                                      :offset => 
@photo_pages.current.offset)
    respond_to do |format|
      format.html # index.rhtml
      format.xml { render :xml => @photos.to_xml }
    end
  end

  def show
    @photo = Photo.find_by_user_id_and_id(params[:user_id],
                                          params[:id],
                                          :include => :user)

    respond_to do |format|
      format.html # show.rhtml
      format.xml { render :xml => @photo.to_xml }
    end
  end
  .
  .
  .

Attachments:
http://www.ruby-forum.com/attachment/3296/user_photos_controller.rb

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