action_access
action_access copied to clipboard
Rails 5 API: undefined method `helper_method'
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.
Looks like they solved it by simply wrapping the call with a responds_to?
check
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: https://github.com/activescaffold/active_scaffold/commit/70a11454ee6e74290fd92b075e92dc7d8fac6c3b
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>'
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.