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

Undefined method `helper_method' for RailsAdmin::ApplicationController #2688

Closed
mingyeow opened this issue Aug 13, 2016 · 5 comments
Closed

Comments

@mingyeow
Copy link

Hi, when i am starting rails admin for the first time, i am getting this error.

I have installed and used rails admin before (w different base configurations), so i am puzzled about why this might occur.

I am using Docker, although that does not seem to be the main problem here.

# FROM GEMFILE
source 'https://rubygems.org'
ruby '2.3.1'
gem 'rails', '~> 5.0.0'
gem 'pg', '~> 0.18'
gem 'puma', '~> 3.0'

gem 'remotipart', github: 'mshibuya/remotipart'
gem 'rails_admin', '>= 1.0.0.rc'
# ERROR CALLSTACK 
app_1       | => Booting Puma
app_1       | => Rails 5.0.0 application starting in development on https://0.0.0.0:3000
app_1       | => Run `rails server -h` for more startup options
app_1       | [11] Puma starting in cluster mode...
app_1       | [11] * Version 3.6.0 (ruby 2.3.1-p112), codename: Sleepy Sunday Serenity
app_1       | [11] * Min threads: 5, max threads: 5
app_1       | [11] * Environment: development
app_1       | [11] * Process workers: 2
app_1       | [11] * Phased restart available
app_1       | [11] * Listening on tcp:https://0.0.0.0:3000
app_1       | [11] Use Ctrl-C to stop
app_1       | [11] - Worker 0 (pid: 21) booted, phase: 0
app_1       | [11] - Worker 1 (pid: 32) booted, phase: 0
app_1       | Started GET "/admin" for 172.17.0.1 at 2016-08-13 23:38:14 +0000
app_1       |   ActiveRecord::SchemaMigration Load (0.9ms)  SELECT "schema_migrations".* FROM "schema_migrations"
app_1       |   
app_1       | ActionController::RoutingError (undefined method `helper_method' for RailsAdmin::ApplicationController:Class):
app_1       |   
app_1       | rails_admin (1.0.0.rccontrollers) rails_admin/application_controller.rb:18:in `<class:ApplicationController>'
app_1       | rails_admin (1.0.0.rccontrollers) rails_admin/application_controller.rb:13:in `<module:RailsAdmin>'
app_1       | rails_admin (1.0.0.rccontrollers) rails_admin/application_controller.rb:3:in `<top (required)>'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:477:in `load'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:477:in `block in load_file'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:662:in `new_constants_in'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:476:in `load_file'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:375:in `block in require_or_load'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:37:in `block in load_interlock'
app_1       | activesupport (5.0.0) lib/active_support/dependencies/interlock.rb:12:in `block in loading'
app_1       | activesupport (5.0.0) lib/active_support/concurrency/share_lock.rb:117:in `exclusive'
app_1       | activesupport (5.0.0) lib/active_support/dependencies/interlock.rb:11:in `loading'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:37:in `load_interlock'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:358:in `require_or_load'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:511:in `load_missing_constant'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:203:in `const_missing'
app_1       | rails_admin (1.0.0.rccontrollers) rails_admin/main_controller.rb:2:in `<module:RailsAdmin>'
app_1       | rails_admin (1.0.0.rccontrollers) rails_admin/main_controller.rb:1:in `<top (required)>'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:477:in `load'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:477:in `block in load_file'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:662:in `new_constants_in'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:476:in `load_file'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:375:in `block in require_or_load'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:37:in `block in load_interlock'
app_1       | activesupport (5.0.0) lib/active_support/dependencies/interlock.rb:12:in `block in loading'
app_1       | activesupport (5.0.0) lib/active_support/concurrency/share_lock.rb:117:in `exclusive'
app_1       | activesupport (5.0.0) lib/active_support/dependencies/interlock.rb:11:in `loading'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:37:in `load_interlock'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:358:in `require_or_load'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:511:in `load_missing_constant'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:203:in `const_missing'
app_1       | activesupport (5.0.0) lib/active_support/inflector/methods.rb:270:in `const_get'
app_1       | activesupport (5.0.0) lib/active_support/inflector/methods.rb:270:in `block in constantize'
app_1       | activesupport (5.0.0) lib/active_support/inflector/methods.rb:266:in `each'
app_1       | activesupport (5.0.0) lib/active_support/inflector/methods.rb:266:in `inject'
app_1       | activesupport (5.0.0) lib/active_support/inflector/methods.rb:266:in `constantize'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:583:in `get'
app_1       | activesupport (5.0.0) lib/active_support/dependencies.rb:614:in `constantize'
app_1       | actionpack (5.0.0) lib/action_dispatch/http/request.rb:93:in `controller_class'
app_1       | actionpack (5.0.0) lib/action_dispatch/routing/route_set.rb:44:in `controller'
app_1       | actionpack (5.0.0) lib/action_dispatch/routing/route_set.rb:30:in `serve'
app_1       | actionpack (5.0.0) lib/action_dispatch/journey/router.rb:39:in `block in serve'
app_1       | actionpack (5.0.0) lib/action_dispatch/journey/router.rb:26:in `each'
app_1       | actionpack (5.0.0) lib/action_dispatch/journey/router.rb:26:in `serve'
app_1       | actionpack (5.0.0) lib/action_dispatch/routing/route_set.rb:725:in `call'
app_1       | railties (5.0.0) lib/rails/engine.rb:522:in `call'
app_1       | railties (5.0.0) lib/rails/railtie.rb:193:in `public_send'
app_1       | railties (5.0.0) lib/rails/railtie.rb:193:in `method_missing'
app_1       | actionpack (5.0.0) lib/action_dispatch/routing/mapper.rb:17:in `block in <class:Constraints>'
app_1       | actionpack (5.0.0) lib/action_dispatch/routing/mapper.rb:46:in `serve'
app_1       | actionpack (5.0.0) lib/action_dispatch/journey/router.rb:39:in `block in serve'
app_1       | actionpack (5.0.0) lib/action_dispatch/journey/router.rb:26:in `each'
app_1       | actionpack (5.0.0) lib/action_dispatch/journey/router.rb:26:in `serve'
app_1       | actionpack (5.0.0) lib/action_dispatch/routing/route_set.rb:725:in `call'
app_1       | rack-pjax (1.0.0) lib/rack/pjax.rb:12:in `call'
app_1       | /bundle/bundler/gems/remotipart-88d9a7d55bde/lib/remotipart/middleware.rb:32:in `call'
app_1       | rack (2.0.1) lib/rack/etag.rb:25:in `call'
app_1       | rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
app_1       | rack (2.0.1) lib/rack/head.rb:12:in `call'
app_1       | activerecord (5.0.0) lib/active_record/migration.rb:552:in `call'
app_1       | actionpack (5.0.0) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
app_1       | activesupport (5.0.0) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
app_1       | activesupport (5.0.0) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
app_1       | activesupport (5.0.0) lib/active_support/callbacks.rb:90:in `run_callbacks'
app_1       | actionpack (5.0.0) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
app_1       | actionpack (5.0.0) lib/action_dispatch/middleware/executor.rb:12:in `call'
app_1       | actionpack (5.0.0) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
app_1       | actionpack (5.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
app_1       | actionpack (5.0.0) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
app_1       | railties (5.0.0) lib/rails/rack/logger.rb:36:in `call_app'
app_1       | railties (5.0.0) lib/rails/rack/logger.rb:24:in `block in call'
app_1       | activesupport (5.0.0) lib/active_support/tagged_logging.rb:70:in `block in tagged'
app_1       | activesupport (5.0.0) lib/active_support/tagged_logging.rb:26:in `tagged'
app_1       | activesupport (5.0.0) lib/active_support/tagged_logging.rb:70:in `tagged'
app_1       | railties (5.0.0) lib/rails/rack/logger.rb:24:in `call'
app_1       | actionpack (5.0.0) lib/action_dispatch/middleware/request_id.rb:24:in `call'
app_1       | rack (2.0.1) lib/rack/runtime.rb:22:in `call'
app_1       | activesupport (5.0.0) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
app_1       | actionpack (5.0.0) lib/action_dispatch/middleware/executor.rb:12:in `call'
app_1       | actionpack (5.0.0) lib/action_dispatch/middleware/static.rb:136:in `call'
app_1       | rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
app_1       | railties (5.0.0) lib/rails/engine.rb:522:in `call'
app_1       | puma (3.6.0) lib/puma/configuration.rb:225:in `call'
app_1       | puma (3.6.0) lib/puma/server.rb:578:in `handle_request'
app_1       | puma (3.6.0) lib/puma/server.rb:415:in `process_client'
app_1       | puma (3.6.0) lib/puma/server.rb:275:in `block in run'
app_1       | puma (3.6.0) lib/puma/thread_pool.rb:116:in `block in spawn_thread'


@mshibuya
Copy link
Member

Now RailsAdmin master should work out-of-box with Rails 5 API mode.
Thanks for reporting!

@mingyeow
Copy link
Author

hi @mshibuya thanks for the great work! i redid the gem install - but i do not see the updates. Is the gem spec going to be updated, or do i need to specify the gem file differently from:
gem 'rails_admin', '>= 1.0.0.rc'

@SuperMasterBlasterLaser
Copy link
Contributor

@mingyeow You should write in your gemfile something like this:

gem 'rails_admin', github: 'sferik/rails_admin'

New bugfixes does not appear in rubygems. It will be updated when new release version appears.

@mingyeow
Copy link
Author

@mshibuya @SuperMasterBlasterLaser thank you so much! appreciate it.

I am getting this error when trying to edit/delete anything. does this have anything to do wih the above changes?

Thank you so much for doing all the great work!

{ status: 404, error: "Not Found", exception: "#<ActionController::RoutingError: No route matches [POST] "/admin/user/11/edit">", traces: { Application Trace: [ ], Framework Trace: [ { id: 0, trace: "actionpack (5.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:53:incall'"
},
{
id: 1,
trace: "actionpack (5.0.0) lib/action_dispatch/middleware/show_exceptions.rb:31:in call'" }, { id: 2, trace: "railties (5.0.0) lib/rails/rack/logger.rb:36:incall_app'"
},
{
id: 3,
trace: "railties (5.0.0) lib/rails/rack/logger.rb:24:in block in call'" }, { id: 4, trace: "activesupport (5.0.0) lib/active_support/tagged_logging.rb:70:inblock in tagged'"
},
{
id: 5,
trace: "activesupport (5.0.0) lib/active_support/tagged_logging.rb:26:in tagged'" }, { id: 6, trace: "activesupport (5.0.0) lib/active_support/tagged_logging.rb:70:intagged'"
},
{
id: 7,
trace: "railties (5.0.0) lib/rails/rack/logger.rb:24:in call'" }, { id: 8, trace: "actionpack (5.0.0) lib/action_dispatch/middleware/request_id.rb:24:incall'"
},
{
id: 9,
trace: "rack (2.0.1) lib/rack/runtime.rb:22:in call'" }, { id: 10, trace: "activesupport (5.0.0) lib/active_support/cache/strategy/local_cache_middleware.rb:28:incall'"
},
{
id: 11,
trace: "actionpack (5.0.0) lib/action_dispatch/middleware/executor.rb:12:in call'" }, { id: 12, trace: "actionpack (5.0.0) lib/action_dispatch/middleware/static.rb:136:incall'"
},
{
id: 13,
trace: "rack (2.0.1) lib/rack/sendfile.rb:111:in call'" }, { id: 14, trace: "railties (5.0.0) lib/rails/engine.rb:522:incall'"
},
{
id: 15,
trace: "puma (3.6.0) lib/puma/configuration.rb:225:in call'" }, { id: 16, trace: "puma (3.6.0) lib/puma/server.rb:578:inhandle_request'"
},
{
id: 17,
trace: "puma (3.6.0) lib/puma/server.rb:415:in process_client'" }, { id: 18, trace: "puma (3.6.0) lib/puma/server.rb:275:inblock in run'"
},
{
id: 19,
trace: "puma (3.6.0) lib/puma/thread_pool.rb:116:in block in spawn_thread'" } ], Full Trace: [ { id: 0, trace: "actionpack (5.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:53:incall'"
},
{
id: 1,
trace: "actionpack (5.0.0) lib/action_dispatch/middleware/show_exceptions.rb:31:in call'" }, { id: 2, trace: "railties (5.0.0) lib/rails/rack/logger.rb:36:incall_app'"
},
{
id: 3,
trace: "railties (5.0.0) lib/rails/rack/logger.rb:24:in block in call'" }, { id: 4, trace: "activesupport (5.0.0) lib/active_support/tagged_logging.rb:70:inblock in tagged'"
},
{
id: 5,
trace: "activesupport (5.0.0) lib/active_support/tagged_logging.rb:26:in tagged'" }, { id: 6, trace: "activesupport (5.0.0) lib/active_support/tagged_logging.rb:70:intagged'"
},
{
id: 7,
trace: "railties (5.0.0) lib/rails/rack/logger.rb:24:in call'" }, { id: 8, trace: "actionpack (5.0.0) lib/action_dispatch/middleware/request_id.rb:24:incall'"
},
{
id: 9,
trace: "rack (2.0.1) lib/rack/runtime.rb:22:in call'" }, { id: 10, trace: "activesupport (5.0.0) lib/active_support/cache/strategy/local_cache_middleware.rb:28:incall'"
},
{
id: 11,
trace: "actionpack (5.0.0) lib/action_dispatch/middleware/executor.rb:12:in call'" }, { id: 12, trace: "actionpack (5.0.0) lib/action_dispatch/middleware/static.rb:136:incall'"
},
{
id: 13,
trace: "rack (2.0.1) lib/rack/sendfile.rb:111:in call'" }, { id: 14, trace: "railties (5.0.0) lib/rails/engine.rb:522:incall'"
},
{
id: 15,
trace: "puma (3.6.0) lib/puma/configuration.rb:225:in call'" }, { id: 16, trace: "puma (3.6.0) lib/puma/server.rb:578:inhandle_request'"
},
{
id: 17,
trace: "puma (3.6.0) lib/puma/server.rb:415:in process_client'" }, { id: 18, trace: "puma (3.6.0) lib/puma/server.rb:275:inblock in run'"
},
{
id: 19,
trace: "puma (3.6.0) lib/puma/thread_pool.rb:116:in block in spawn_thread'" } ] } }

@saravanabalagi
Copy link

You need to add config.middleware.use Rack::MethodOverride in application.rb for rails-5-api.
And everything will work like charm :)

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

4 participants