Rails.logger is nil when invoking rake tasks

Good morning everybody,

is it expected for the Rails.logger to be left uninitialized before
executing a rake task?
These are the steps to reproduce my test:
https://gist.github.com/olistik/9068351

Thanks

On Tuesday, February 18, 2014 10:35:26 AM UTC, maurizio de magnis wrote:

Good morning everybody,

is it expected for the Rails.logger to be left uninitialized before
executing a rake task?
These are the steps to reproduce my test:
https://gist.github.com/olistik/9068351

With a task like that, the rails environment is not loaded, so I
wouldn’t
expect much in the way of rails to be setup. If you set your task to
depend
on the :environment task then Rails should be setup for you.

Fred

On Tuesday, February 18, 2014 11:51:54 AM UTC+1, Frederick C. wrote:

https://gist.github.com/olistik/9068351

With a task like that, the rails environment is not loaded, so I wouldn’t
expect much in the way of rails to be setup. If you set your task to depend
on the :environment task then Rails should be setup for you.

Thanks, I’ve updated the gist :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs