This is line 8
"elseif current_user.id.to_s == params[:user_id]"
And here is the code form the start of the file to the end of the index
method.
class GalleriesController < ApplicationController
#before_filter :require_user, :only => [:new, :create, :edit, :update,
:destroy]
def index
if params[:user_id].blank?
@galleries = Gallery.find(:all)
elseif current_user.id.to_s == params[:user_id]
@galleries = current_user.galleries
else
@user = User.find(params[:user_id])
@galleries = @user.visible_galleries
end
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @galleries }
end
end
Rob Biedenharn wrote:
> On Jan 21, 2009, at 2:00 PM, Mohammad Abed wrote:
>
>> Parameters: {"action"=>"index", "controller"=>"galleries"}
>> Gallery Load (2.0ms) SELECT * FROM `galleries`
>>
>>
>> RuntimeError (Called id for nil, which would mistakenly be 4 -- if you
>> really wanted the id of nil, use object_id):
>> /app/controllers/galleries_controller.rb:8:in `index'
>
> Aha! OK, what is on line 8? (If that doesn't solve it for you, paste
> the first part of the galleries_controller.rb up to the end of the
> index method.)
>
> -Rob
--
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
-~----------~----~----~----~------~----~------~--~---