This project is archived and is in readonly mode.
Rails.configuration.to_prepare code not getting executed
Reported by dennis collective | August 24th, 2010 @ 09:22 AM
I'm using the rails_warden gem, which via middleware magic
injects a lazy proxy object as env['warden']. When I wrap its
initialization in config.to_prepare env['warden'] is nil.
my config/initializers/warden.rb:
Rails.configuration.to_prepare do
Rails.configuration.middleware.use RailsWarden::Manager do |config|
config.failure_app = UserSessionsController
config.default_strategies(:awesome)
end
Warden::Strategies.add(:awesome) do
def authenticate!
user = User.find(1)
success!(user)
end
end
end
after booting the app, I tried to do some logging statements and
raise a runtime error:
Rails.configuration.to_prepare do
logger.info "this did not show up in my logs"
raise "and this did not get raised"
Rails.configuration.middleware.use RailsWarden::Manager do |config|
...
end
but neither worked, a whiny nil was raised when the request called env['warden'].authenticate!
all of this works without the to_prepare block, but it's a bit of a pain to restart the app everytime there is a change.
Comments and changes to this ticket
-
Neeraj Singh December 9th, 2010 @ 02:35 AM
- Importance changed from to Low
If I add following lines to my code then I do get raise message. Can you elaborate on what is the issue you are running into.
Rails.configuration.to_prepare do puts "this did not show up in my logs" raise "and this did not get raised" end
-
rails March 10th, 2011 @ 12:00 AM
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
rails March 10th, 2011 @ 12:00 AM
- State changed from open to stale
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>