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

Railtie requires a controller named ApplicationController #573

Closed
wgrrrr opened this issue Sep 10, 2013 · 4 comments
Closed

Railtie requires a controller named ApplicationController #573

wgrrrr opened this issue Sep 10, 2013 · 4 comments

Comments

@wgrrrr
Copy link

wgrrrr commented Sep 10, 2013

The railtie for Draper appears to require a controller named ApplicationController to exist. This is a big problem for people (like myself) who don't use the standard naming convention for the base controller.

I believe this should be configurable to allow non-standard naming conventions.

https://github.com/drapergem/draper/blob/master/lib/draper/railtie.rb#L55

Thoughts?

/Users/me/.rvm/gems/ruby-2.0.0-p247@gemset/gems/draper-1.2.1/lib/draper/railtie.rb:55:in `block in <class:Railtie>': uninitialized constant Draper::Railtie::ApplicationController (NameError)
    from /Users/me/.rvm/gems/ruby-2.0.0-p247@gemset/gems/railties-4.0.0/lib/rails/railtie.rb:188:in `call'
    from /Users/me/.rvm/gems/ruby-2.0.0-p247@gemset/gems/railties-4.0.0/lib/rails/railtie.rb:188:in `block in run_console_blocks'
    from /Users/me/.rvm/gems/ruby-2.0.0-p247@gemset/gems/railties-4.0.0/lib/rails/railtie.rb:188:in `each'
    from /Users/me/.rvm/gems/ruby-2.0.0-p247@gemset/gems/railties-4.0.0/lib/rails/railtie.rb:188:in `run_console_blocks'
    from /Users/me/.rvm/gems/ruby-2.0.0-p247@gemset/gems/railties-4.0.0/lib/rails/application.rb:264:in `block in run_console_blocks'
    from /Users/me/.rvm/gems/ruby-2.0.0-p247@gemset/gems/railties-4.0.0/lib/rails/engine/railties.rb:17:in `each'
    from /Users/me/.rvm/gems/ruby-2.0.0-p247@gemset/gems/railties-4.0.0/lib/rails/engine/railties.rb:17:in `each'
    from /Users/me/.rvm/gems/ruby-2.0.0-p247@gemset/gems/railties-4.0.0/lib/rails/application.rb:264:in `run_console_blocks'
    from /Users/me/.rvm/gems/ruby-2.0.0-p247@gemset/gems/railties-4.0.0/lib/rails/engine.rb:431:in `load_console'
    from /Users/me/.rvm/gems/ruby-2.0.0-p247@gemset/gems/railties-4.0.0/lib/rails/commands/console.rb:51:in `initialize'
    from /Users/me/.rvm/gems/ruby-2.0.0-p247@gemset/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in `new'
    from /Users/me/.rvm/gems/ruby-2.0.0-p247@gemset/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in `start'
    from /Users/me/.rvm/gems/ruby-2.0.0-p247@gemset/gems/railties-4.0.0/lib/rails/commands.rb:64:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'
@steveklabnik
Copy link
Member

Yes, we had a previous issue about this. Basically, if you can work up a patch, then I'll apply it, but I can't think of how to make it work well.

@wgrrrr
Copy link
Author

wgrrrr commented Sep 11, 2013

I can see that being a challenge given there is no initializer or other way to really globally tell Draper about this.

I'll take a look through the discussions in #528 and #249 and see what I can come up with.

@wgrrrr
Copy link
Author

wgrrrr commented Sep 11, 2013

For the time being, I've put this in an initializer:

if defined?(Rails::Console)
  require 'action_controller'
  class ApplicationController < ActionController::Base; end
end

I have only verified that the Rails console will start, but not that anything related to draper or my controllers works (I'm not that far in developing my app yet).

@steveklabnik
Copy link
Member

Closing because it's not exactly a bug. Same as before: if someone has a solution to make this configurable, I'm all ears.

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

No branches or pull requests

2 participants