OK - I managed to figure it out myself using: user_id = current_user.id @posts = Post.find_all_by_user_id(user_id)
That works great for the index method. Where I'm having trouble now is the Show method. As it stands, clicking on the title of one of the projects calls the Show method like http://localhost:3000/projects/1 The problem is, if the user types manually into the address bar, they could call up whichever project id they want. Can someone give me a hand with the show method. I'm thinking that an If statement checking to see if the project.user_id for the project.id in the parameter match. If not, redirect. If so, then go ahead and show the project record. I'm not sure of syntax: def show user_id = current_user.id If user_id = :id then @post = Post.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @post } end Else redirect_back_or_default('/projects') end if end Vince Gilbert wrote: > Thank you very much for the help. I am starting to build a schema in my > brain as to how some of this works. > > I have a small problem with the last instruction. How do I use the > "user.projects" in the index method below: > > Thank you again - much appreciated. > > # GET /posts > # GET /posts.xml > def index > @posts = Post.find(:all, :order => 'created_at DESC') > respond_to do |format| > format.html # index.html.erb > format.xml { render :xml => @posts } > end > end > > > Mark Mr wrote: >>Finally >> to display them simply use user.projects >> >> Hope this helped. -- 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 -~----------~----~----~----~------~----~------~--~---

