Is it possible to include / use Application Helper methods inside of an config/initializers/browser_blocker.rb
?
I am using the browser gem to detect and b
Ofcourse you can but that's bad idea, i agree with that that logic supposed to somewhere in app
but sometime you have to deal with it. I am saying this because you can block the request before old_browser
request gets it and load rails stack
.
Anyway, this is how can you can do it
Rails.configuration.middleware.use Browser::Middleware do
self.class.send(:include,ApplicationHelper)
redirect_to :controller => 'error', :action => 'browser-upgrade-required' unless browser_is_supported?
end