Colin Law wrote in post #1001554: > On 26 May 2011 23:12, Caroline M. <li...@ruby-forum.com> wrote: >> > > In the controller fetch the records where that is the id. > @products = Product.where( :user_id => 1)
oh thank you so much it worked!!! knew it was along this lines but i hadn't the syntax right n hadn't the .where either. >> on the user_products controller in the index view i want the products >> of the logged in user only to display, > > In this case > @products = current_user.products again brilliant, im act cant believe where my head is..above statement fairly obvious, think my head is so frazzled with ruby im not seeing common sense. > Where it goes after the create action is up to the code you have > written. After the save call you probably have a redirect_to > statement which tells the browser which page to fetch next. In each > controller specify where you want it to go. now that you point it out, im like of course, duh, ha. il have a play around with it and see, it was the same as the products controller so obv it was going there. > I think in an earlier post I suggested working through > railstutorial.org. thanks for that will have a look, hopefully help me avoid stupid pitfalls in the future. > you will look back on these questions and be embarrassed that you had > to ask them. :) already there ha now surprise surprise ive encountered another problem after i did above changes. ok so my index view now works perfectly in user_products controller.but when i click on create new product an error pops up. it was working fine, so dunno why a problem is caused now.unless ive done something stupid again. ive put whats showing up in the attached pdf. not sure what else to show you..i tried changing @product to @current_user.product but that didn't help. :/ thanks for your time and patience!! Attachments: http://www.ruby-forum.com/attachment/6246/error.pdf -- 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 rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.