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

Rails 5 API: undefined method `helper_method' #12

Open
griley opened this issue Sep 15, 2016 · 3 comments
Open

Rails 5 API: undefined method `helper_method' #12

griley opened this issue Sep 15, 2016 · 3 comments

Comments

@griley
Copy link

griley commented Sep 15, 2016

Attempting use action_access in a Rails 5 app that is using using rails api I receive the following:

NoMethodError: undefined method `helper_method' for ActionController::API:Class
  /Users/griley/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/action_access-0.1.1/lib/action_access/controller_additions.rb:51:in `included'

This is the same issue that the devise gem encountered.

@griley
Copy link
Author

griley commented Sep 15, 2016

Looks like they solved it by simply wrapping the call with a responds_to? check

@janwiemers
Copy link

following up on this thread. I'm currently experience the same isdue in combination with the audited gem. I've found a similar issue with them but am currently kind a stuck.
Would be great if you can take a look at it.
the Issue I found is this one: activescaffold/active_scaffold@70a1145

and this is stack trace

/home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/action_access-0.1.1/lib/action_access/controller_additions.rb:51:in `included': undefined method `helper_method' for ActionController::API:Class (NoMethodError)
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/action_access-0.1.1/lib/action_access/railtie.rb:8:in `include'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/action_access-0.1.1/lib/action_access/railtie.rb:8:in `block (2 levels) in <class:Railtie>'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:43:in `instance_eval'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:43:in `execute_hook'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:33:in `block in on_load'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:32:in `each'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:32:in `on_load'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/action_access-0.1.1/lib/action_access/railtie.rb:7:in `block in <class:Railtie>'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `instance_exec'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `run'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `call'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:54:in `run_initializers'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/application.rb:352:in `initialize!'
	from /recertify/config/environment.rb:5:in `<top (required)>'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `block in require'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/application.rb:328:in `require_environment!'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:157:in `require_application_and_environment!'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:143:in `generate_or_destroy'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:60:in `generate'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
	from /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
	from bin/rails:9:in `require'
	from bin/rails:9:in `<main>'

@janwiemers
Copy link

I've found out that if I comment out this line: https://github.com/collectiveidea/audited/blob/master/lib/audited/sweeper.rb#L47 it works like a charm. I'll file a Issue for audited as well.

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