Yep, It does take a while to learn Ruby! This worked when I reordered 
the if statements and checked if the current_user is nil. Thanks David 
for pointing me in the right direction, also thanks to Rob for 
mentioning it above. Here is what worked


if params[:user_id]
  @user = current_user
  if params[:user_id] && [email protected]?
     @galleries = @user.galleries
  end
  @user = User.find(params[:user_id])
  @galleries = @user.visible_galleries
  else
  galleries = Gallery.find(:all, :conditions => ['visibility_status = 
?', true])
    end


David A. Black wrote:
> Hi --
> 
> On Wed, 21 Jan 2009, Mohammad Abed wrote:> 

>>
>>  def index
>>
>>    if params[:user_id].blank?
>>        @galleries = Gallery.find(:all)
>>    elseif current_user.id.to_s == params[:user_id]
>>         @galleries = current_user.galleries
> 
> One way or another, current_user is returning nil. So you'd have to
> track that down and fix it, or work around not having a current user
> in this action.
> 
> 
> David
> 
> --
> David A. Black / Ruby Power and Light, LLC
> Ruby/Rails consulting & training: http://www.rubypal.com
> Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2)
> 
> http://www.wishsight.com => Independent, social wishlist management!

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