Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uninitialized constant ActionController::AbstractRequest with --prefix option #2

Open
gmjosack opened this issue Mar 26, 2010 · 9 comments

Comments

@gmjosack
Copy link

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

@luislavena
Copy link
Contributor

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

@siggy
Copy link

siggy commented May 1, 2010

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

@luislavena
Copy link
Contributor

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.

@gmjosack
Copy link
Author

gmjosack commented May 3, 2010

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

@luislavena
Copy link
Contributor

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.

@jeantil
Copy link

jeantil commented Aug 24, 2010

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 ?

@luislavena
Copy link
Contributor

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.

@jeantil
Copy link

jeantil commented Aug 24, 2010

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.

@luislavena
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants