Hi all, I''m a newbie. When I test some models in the console, how can I find the generated sql at background? Also, one of my table "quotes" has compound primary key "date" and "ticker", how can I declare that as the foreign key of another table "portfolios"? What''s the convention here? Thanks Sky
The test log output is in <your rails dir>/log/test.log For the compound key, sorry, not sure. - jason On Nov 26, 2005, at 12:25 PM, Sky Yin wrote:> Hi all, I''m a newbie. > > When I test some models in the console, how can I find the generated > sql at background? > > Also, one of my table "quotes" has compound primary key "date" and > "ticker", how can I declare that as the foreign key of another table > "portfolios"? What''s the convention here? > > Thanks > > Sky > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Thanks, but there''s nothing in test.log, only development.log repeating what I''ve seen in the console. I got "42000You have an error in your SQL syntax" error message on Mysql5 when using join table, so I want to see what exactly the SQL is. On 11/26/05, Jason Lee <jasonlee9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > The test log output is in <your rails dir>/log/test.log > > For the compound key, sorry, not sure. > > - jason > > On Nov 26, 2005, at 12:25 PM, Sky Yin wrote: > > > Hi all, I''m a newbie. > > > > When I test some models in the console, how can I find the generated > > sql at background? > > > > Also, one of my table "quotes" has compound primary key "date" and > > "ticker", how can I declare that as the foreign key of another table > > "portfolios"? What''s the convention here? > > > > Thanks > > > > Sky > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
The context: project HABTM tags tags HABTM project In a controller i do the following @project = Project.new @tag = Tag.new So I have now a new project and a new tag, but nothing is created in the database. When I do @project.tags << @tag the tag is added to the database. I don''t want this behaviour. What I want is a @project with @tags inside but nothing into the database. Data should be saved only when I do @project.save. How can i do ? -- Posted via http://www.ruby-forum.com/.