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-activerecordhttp://railscasts.com/episodes/48-console-tricks
5 comments:
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.
Thanks for reading
Good tips ,its very much useful and helpful tips....
Web Development
Good tips ,its very much useful and helpful tips....
Web Development
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
Post a Comment