mongrel icon indicating copy to clipboard operation
mongrel copied to clipboard

uninitialized constant ActionController::AbstractRequest with --prefix option

Open gmjosack opened this issue 15 years ago • 9 comments

I'm using 1.1.5 but this appears to still be an issue in master. Apparently the ActionController has been changed heavily in newer versions of rails and no longer has a AbstractRequest class. I'm currently using 2.3.4. I have tested and this can be fixed with the following:

-        ActionController::AbstractRequest.relative_url_root = ops[:prefix] if ops[:prefix]
+        ActionController::Base.relative_url_root = ops[:prefix] if ops[:prefix]

in lib/mongrel/rails.rb

gmjosack avatar Mar 26 '10 18:03 gmjosack

That will break older versions of Rails.

A better patch that covers support for 2.2 and 2.3 versions will be good.

Thank you

luislavena avatar Apr 03 '10 10:04 luislavena

Hi Luis,

I believe this workaround in lib/mongrel/rails.rb will deal with multiple versions of Rails:

151c151,158
<         ActionController::AbstractRequest.relative_url_root = ops[:prefix] if ops[:prefix]
---
>         # hack to deal with removal of ActionController::AbstractRequest
>         if defined? ActionController::AbstractRequest
>           # Rails < 2.3
>           ActionController::AbstractRequest.relative_url_root = ops[:prefix] if ops[:prefix]
>         else
>           # Rails >= 2.3
>           ActionController::Base.relative_url_root = ops[:prefix] if ops[:prefix]
>         end

FYI, some folks have attempted corresponding workarounds in Rails

siggy avatar May 01 '10 19:05 siggy

Thank you siggy for the workaround.

Going to apply this to master and see the results across 1.2, 2.2, 2.3 and 3 version of Rails.

luislavena avatar May 01 '10 23:05 luislavena

Thanks siggy! I've been busy and haven't had time to look back at this so I'm glad to see progress made!

gmjosack avatar May 03 '10 22:05 gmjosack

Hello siggy and gmjosack

The issue is deeper than just the AbstractRequest call. Internal changes around dispatcher and the way request are handled will not work.

You can see this here:

http://gist.github.com/391471

The idea is bring the rack adapter from Unicorn to fix that issue, but not going to happen in 1.2 version.

luislavena avatar May 05 '10 21:05 luislavena

This issue is probably related to https://rails.lighthouseapp.com/projects/8994/tickets/4524-mongrel-under-rails-3-beta-3#ticket-4524-7

any update on this ?

jeantil avatar Aug 24 '10 12:08 jeantil

Any patch from there? (no monkey patch, please)

And if you read my previous comment, the solution needs to work with both versions of rails, 3.0 and lower.

luislavena avatar Aug 24 '10 12:08 luislavena

Unfortunately no patch just an issue with mongrel trying to access dispatcher which doesn't exist anymore. I can't help notice mongrel_rails fails to start, but rails server seems to start mongrel just fine. I assume it is linked to some kind of monkey patching by rails when starting mongrel, but I don't have details and I can't say I understand the root cause of the issue. The analysis I have seen for the moment assume a larger understanding of both code bases and external options than I have.

jeantil avatar Aug 24 '10 13:08 jeantil

Indeed.

Also, the patch shown in previous commits do not work as other stuff has been changed, not just the dispatcher.

rails server works because it start mongrel in a different way.

luislavena avatar Aug 24 '10 13:08 luislavena