Wednesday, October 14, 2009

Script Console Tricks

Script console in rails helps me very much to debug my applications. However, I usually encounter an annoying problem with ActiveRecord. I want to see the generated SQL that has been executed. I never have enough time to figure out this until last week. Just add the following code to your environment.rb, you could see the generated SQL statement.


if "irb" == $0
ActiveRecord::Base.logger = Logger.new(STDOUT) # ActiveRecord
ActiveResource::Base.logger = Logger.new(STDOUT) # ActiveResource
end


For more information:
http://weblog.jamisbuck.org/2007/1/31/more-on-watching-activerecord
http://railscasts.com/episodes/48-console-tricks

7 comments:

Anonymous said...

It was rather interesting for me to read this article. Thank author for it. I like such topics and everything connected to this matter. I definitely want to read a bit more soon.

chamnap said...

Thanks for reading

Webplore said...

Good tips ,its very much useful and helpful tips....
Web Development

Webplore said...

Good tips ,its very much useful and helpful tips....
Web Development

Web Design Company Dubai said...

I read your blog very impressed seen this kind of important information’s. Really am interested to back to your blog again to gather some more information’s

http://www.infoquestit.com

Linda Grase said...

It was fairly fascinating for me to peruse this article. Thank creator for it. I like such themes and everything associated with this matter. I certainly need to peruse notably all the more soon..


E-Commerce Website Design//Creative Apps And Webs

Howard Henry said...

I am impressed your provided information is very helpful for me. I think WordPress is a content management software that you can use it to create a beautiful website or blog. WordPress is free, but the kind of features and ease of utilization are priceless. There are over 60 million people who are using WordPress CMS to power their website.

Subscribe in a Reader