Tip for totally clueless people like me: it has to be put outside of the "Rails::Initializer.run do |config| ... end" section (at least I got a scary error when I put it in there).
I know next to nothing about Ruby and even less about Rails, but I'm trying to design our company's web-service API to be as ActiveResource-friendly as possible. In my book that means I have to develop at least a simple Rails app that exercises all of the API. Combined with my extreme ignorance leads to GSDD (Google-Search Driven Development), which is only possible because of wonderful people like you who put this information where Google can index it.
@DerHeiligste That's probably because inside ActiveRecord::Base.loggers was still nil inside of the config block.
Feel free to ping me should you need any further assistance - I've spent more time than I care to think about alternately developing POX resources and wrestling with ActiveResource, so hopefully I can save you some effort.
9 comments:
Thanks man...big help. Much appreciated.
Thank you!! But I had to put this line inside config/initializers/new_rails_defaults.rb
Thanks a million!
Tip for totally clueless people like me: it has to be put outside of the "Rails::Initializer.run do |config| ... end" section (at least I got a scary error when I put it in there).
I know next to nothing about Ruby and even less about Rails, but I'm trying to design our company's web-service API to be as ActiveResource-friendly as possible. In my book that means I have to develop at least a simple Rails app that exercises all of the API. Combined with my extreme ignorance leads to GSDD (Google-Search Driven Development), which is only possible because of wonderful people like you who put this information where Google can index it.
Again, thanks a million times!
@DerHeiligste That's probably because inside ActiveRecord::Base.loggers was still nil inside of the config block.
Feel free to ping me should you need any further assistance - I've spent more time than I care to think about alternately developing POX resources and wrestling with ActiveResource, so hopefully I can save you some effort.
I have a file that I put in the initializers directory to print the AR queries to STDOUT in script/console. You could do the same with area.
The script is:
# make AR output go to STDOUT in script/console
if "irb" == $0
ActiveRecord::Base.logger = Logger.new(STDOUT)
end
Any way to have the Active Resource loggers also log the http headers going out?
Yes, but you'd have to monkey patch ActiveResource#connection.
I've already patched connection to allow a custom header value but I don't see how to get it to log...
class ActiveResource::Connection
alias :static_default_header :default_header
def set_header(key, value)
default_header.update(key => value)
end
end
where does ActiveResource log to? Or rather, for a rails application in production mode, where does ActiveRecord.logger write to? (production.log?)
I can seem to find ActiveResource calls in the log file even after this change in environment.rb
thanks
Post a Comment