Help :( in my controller Ad layout i have a ''render partial'' that partial will iterate through an array of data from the db, ok basic. but where should i put this line in my Ad controller? @ad = Ad.find_all_by_user_id(sessions[:user]) ( since there''s no particular method, which would''ve been basic and easy.) i''ve tried putting it under the index method, and it works except for the first time the page is called, there is a nil.. i''ve tried putting it under ''initalize'', and that messes the session up. and also tried point blank under the class, and no hope.. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Oops, it''s in dave''s rails app which i''m following now (Creating a cart section of the depot app) has_many_questions wrote:> Help :( in my controller Ad layout i have a ''render partial'' > that partial will iterate through an array of data from the db, ok > basic. > > but where should i put this line in my Ad controller? > @ad = Ad.find_all_by_user_id(sessions[:user]) > ( since there''s no particular method, which would''ve been basic and > easy.) > > i''ve tried putting it under the index method, and it works except for > the first time the page is called, there is a nil.. > i''ve tried putting it under ''initalize'', and that messes the session up. > and also tried point blank under the class, and no hope..-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
has_many_questions wrote:> Oops, it''s in dave''s rails app which i''m following now (Creating a cart > section of the depot app) > > has_many_questions wrote: >> Help :( in my controller Ad layout i have a ''render partial'' >> that partial will iterate through an array of data from the db, ok >> basic. >> >> but where should i put this line in my Ad controller? >> @ad = Ad.find_all_by_user_id(sessions[:user]) >> ( since there''s no particular method, which would''ve been basic and >> easy.) >> >> i''ve tried putting it under the index method, and it works except for >> the first time the page is called, there is a nil.. >> i''ve tried putting it under ''initalize'', and that messes the session up. >> and also tried point blank under the class, and no hope..Glad you found the answer. Just chimed in to say that your "handle" on this list is priceless. It really captures the "dances_with_wolves" feel of the Rails naming conventions. Well done. jp -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---