I know it is not the question you want the answer to but I feel there is something not right about the database organisation. Warning bells ring when you say that you have stocks in two tables. If changing the database organisation is an option then I would suggest considering whether you would be better to have a 'has and belongs to many' relationship between Users and Stocks. If the only thing in Mystocks is the symbol., or other information that is also in the Stocks table then that table becomes a UserStocks table containing only the ids in the conventional HABTM manner. If there is more than just the symbol then the UserStocks table can contain the extra fields.
The advantage will hopefully be that rails, knowing about the relationships between the tables, will be able to do more for you. For example to access the stocks belonging to a user you just have to use user.stocks rather than the find in your original query 1. 2009/3/30 Nick Hoyle <[email protected]> > > Colin Law wrote: > > Sorry, I have lost track of the tables. Is there a Stocks table and a > > Mystocks table and a Users table, or just a Stocks table and a Users > > table? > > > > 2009/3/30 Nick Hoyle <[email protected]> > > > My stocks table which stores the stocks a particular user has, stocks > table which contains the latest stock data and a users table which > contains the user id etc. how ever in my querys i dont involve the users > table as i just pull the user id from the session > -- > 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 -~----------~----~----~----~------~----~------~--~---

