I tried:
after_initialize do
#code
end
But: (documentation)
Some parts of your application, notably observers and routing, are not yet set up at the point where the after_initialize block is called.
I need routing and logger in my code
Any ideas?