when debugging a php application I often echo the SQL statements i created, so i can copy and paste it for testing it in an sql browser to find out what went wrong. Can i do that in rails as wel? Is there any way to see what sql is being submitted? Would be very helpfull -- 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 -~----------~----~----~----~------~----~------~--~---
If you''re in development mode, the SQL queries are all available in the development.log file. Alternatively if you run script/server and keep the terminal window open you''ll see them live in there too. Ross On 9/27/06, Remco Hh <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > when debugging a php application I often echo the SQL statements i > created, so i can copy and paste it for testing it in an sql browser to > find out what went wrong. > > Can i do that in rails as wel? > Is there any way to see what sql is being submitted? > > > Would be very helpfull > > > > > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ross Riley www.sorrylies.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 -~----------~----~----~----~------~----~------~--~---
Remco Hh wrote:> when debugging a php application I often echo the SQL statements i > created, so i can copy and paste it for testing it in an sql browser to > find out what went wrong. > > Can i do that in rails as wel? > Is there any way to see what sql is being submitted? >All your queries are in log/development.log Fred -- 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 -~----------~----~----~----~------~----~------~--~---
Remco Hh wrote:> Can i do that in rails as wel? > Is there any way to see what sql is being submitted? > >While there is probably a way to have the query echoed in your view (I''m afraid I don''t know what it would be), you can always find it in your logs. Each time you load a view, the log will print each query run before the view is rendered. For instance, my development.log is full of entries like: ... [4;35;1mUser Load (0.000594) SELECT * FROM users WHERE (users.id = 2) LIMIT 1 [4;36;1mClient Load (0.000638) [0;1mSELECT * FROM clients WHERE (clients.id = 1) LIMIT 1 Rendered shared/_worklog (0.00322) history: skipped refresh request Completed in 0.06709 (14 reqs/sec) | Rendering: 0.03604 (53%) | DB: 0.01685 (25%) | 200 OK [http://localhost/work_items] ~gwendy --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
> when debugging a php application I often echo the SQL statements i > created, so i can copy and paste it for testing it in an sql browser to > find out what went wrong. > > Can i do that in rails as wel? > Is there any way to see what sql is being submitted?Watch the log file. If you''re on unix you can "tail -f path/to/development.log" and you''ll see the SQL that gets run... -philip --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Sep 27, 2006, at 17:31, Remco Hh wrote:> when debugging a php application I often echo the SQL statements i > created, so i can copy and paste it for testing it in an sql > browser to > find out what went wrong. > > Can i do that in rails as wel? > Is there any way to see what sql is being submitted?Check the logs in your log directory. You probably want development.log. -- Jakob Skjerning - http://mentalized.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---