2009/3/30 Nick Hoyle <[email protected]> > > In my controller i am doing these querys. > > Query 1 > > astock = MyStock.find(:first,:select => "Symbol", :conditions > =>["user_id = ?", session[:idnum]]) > > im wanting to find all the rows from my stock with that particular id. > this works fine.
I think this will only find the first one, not all > > > i then do a second query > > > Query 2 > > @stocks_load = Stocks.find(:all, :conditions => ["Symbol = > ?",astock.Symbol] ) > > this also works fine unless the first query is find(:all then i get > symbol as a undefined method error. > If you mean that it does not work if you do query 2 first, it may be because astock has not been found yet. If you mean it does not work if the query 1 is find(:all,..) then astock will be a collection so astock.Symbol is not valid. astock[0].Symbol might be, for example. > > Do i need some sort of loop that does the query comparsion in row found > from the first query? > > Any help or suggestions would be great! > > Regards > > Nick > -- > 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 -~----------~----~----~----~------~----~------~--~---

