Skip to content

undefined method `helper_method' for ActionController::API:Class #349

@janwiemers

Description

@janwiemers

Hey all,

I just wanted to integrate audited in my application.
after I added the gem to my gemfile and bundled the application is not starting nor generators or rake tasks are working.
I figured that is breaking at the action_access gem similiar to #300
I started my investigation at the action_access gem and update a issue there as well but wasn't able to get to the point where I could potentially fix that.
So I ended up looking into audited and found this line is root cause of this issue.
I added a respond_to? condition to the around_action but not really sure what I'll break with that.
You can find the change here: https://github.com/janwiemers/audited/blob/compatibility_to_action_access/lib/audited/sweeper.rb#L47 would be great if you can take a look into that.

the trace I'm receiving is:

/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>'

thanks a lot
Jan

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions