Hello there,
On my site I have a list of users, each of which can post status
updates on their profile. Each user can search for other users and
view their profiles too.
The odd thing is, if I log in and out of each user and look at their
status, their posts are specific to them (which is what i want)
However...... If I search for a user and click to view their profile,
it seems to display the posts of the logged in user which is what i
dont want.
Below is the show method which is what the profile page uses.
I have tried limiting it to 1 post for a user, and also tried to set
the initial param before the find to try and get around the issue.
Unfortunately these didn''t work..
def show
username = params[:username]
@user = User.find_by_username(username)
if @user
@title = "Profile page of: #{username}"
@info = @user.info ||= Info.new
@posts = Post.find_by_user_id( session[:user_id], :order =>
"created_at DESC")
respond_to do |format|
format.html
end
else
flash[:notice] = "No user #{username} at Pistebuddies!"
redirect_to :action => "index"
end
end
Can anyone see why a: It displays the users status updates correctly
when i''m logged in as each user and b: why the posts seem to stay as
per the logged in user when i click on another user''s profile??
Any suggestions, or ways round this appreciated.
Thanks for reading.
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.