Fix initializer usage to run as soon as possible #15

Closed
wants to merge 1 commit into from

2 participants

@jcwilk

Following up from my comment here: b9f2810

Would be interested to hear if you had any thoughts on a different place to put it in the long chain of slots you can slip it into, but this seems to work fine and my understanding of the problem this gem strives to solve is that sooner is better.

Apologies if I missed something, but I couldn't find anything on the before_configuration method you were trying to use, maybe it might work as config.before_configuration? I think using initializer is more standard though.

John Wilkinson Fix initializer usage to run as soon as possible
before_configuration was throwing NoMethodError
d036668
@bkeepers
Owner

See https://github.com/rails/rails/blob/master/railties/lib/rails/application.rb#L44 and https://github.com/rails/rails/blob/master/railties/lib/rails/railtie/configuration.rb#L51-L54

The problem is that it needs to run even before step 3, which I think unfortunately means that on require is our best option.

@jcwilk

Ok fair enough, it feels strange to have something do it's final purpose right when you require it, but I think it just comes down to practicality... I guess if someone actually had a reason why they would not want it to run that early they could just do require: false in their Gemfile and require it later. I'll go ahead and close the PR, thanks for the explanation though.

@jcwilk jcwilk closed this Dec 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment