-
Notifications
You must be signed in to change notification settings - Fork 526
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 Draper::Railtie::ApplicationController #249
Comments
@steveklabnik what about |
The issue is that we mix things into the ActionController so that we can monkeypatch Honestly, I'm tempted to say 'this rails app is odd, I don't want to complicate Draper to support it, please just make a blank ApplicationController and make your verisioned ones inherit from it.' If we can support this cleanly somehow, I'm not opposed. |
Is it really "odd" to have only namespaced ApplicationControllers? I mean, if I have multiple versions and they all share code, then yeah. I'd have a root AC. That said the different namespaces (versions) will have different inherited methods, constants, etc. I may just add it to get past this bug. Kinda annoyed Rails doesn't have a mechanism like |
To me, yes. This may be a function of my own social circles. |
What makes patching I'm especially interested in this because it seems to me that having your app's base controller named something other than the default seems like a useful deviation from default to me. (For example, I have one project where I make use of multiple base controllers as well). |
The key is here. We want to use the |
Worse is that I'm not even inheriting from ActionController::Base, I'm getting things from |
Right. |
After giving it some thought, I don't want to support this use case. If someone can make it work without significantly complicating our codebase, please open a pull request, but I think this is far enough outside of the usual Rails Way that I don't want to work on supporting it myself. |
I guess when Ruby 2.0 comes out, and is adopted enough to use rely on it, you can use module prepending and have it equally simple to how it works now. One option I was thinking of for now is to extend the instance of the controller with the module, which gives you the parent class. (But don't know enough about the project implementation yet to know if it would be simple in that context) |
I linked to the implementation a few comments up, if you want to check it out. |
Originally brought up in #249, I didn't know how to fix this. But now I do.
So, I think I may have found a solution to this problem: https://github.com/plataformatec/has_scope/pull/31/files#L2L184 Therefore, re-opening and we'll see if we can take care of it. |
That's way cool, thanks reopening. On Nov 24, 2012, at 2:16 PM, Steve Klabnik notifications@github.com wrote:
|
@steveklabnik AFAIK the one remaining |
Seems like it might, but I'd like to determine if it is or not. |
Since ActionController::Base.instance_eval do
include Something
end whereas Draper effectively does this ActionController::Base.class_eval do
include SomethingElse
end by passing So, at the end of the day, they are equivalent. |
Makes sense. |
I want to say I've reported this before, but I can't find it.
Basically Draper doesn't function in the console without an ApplicationController. My API doesn't have an ApplicationController. I only have namespaces (versions) so the class I have is V1::ApplicationController.
I really feel like this was already solved, but I again I can't find anything.
The text was updated successfully, but these errors were encountered: