undefined method `helper_method' for ActionController::API:Class (NoMethodError)
testa19 opened this issue · 6 comments
Hi there,
I'm getting this error after adding Storytime gem to my app's gemfile. Rails 5.
/usr/local/lib/ruby/gems/2.3.0/gems/leather-3.5.1/lib/leather/action_controller_extension.rb:7:in block in <module:ActionControllerExtension>': undefined method
helper_method' for ActionController::API:Class (NoMethodError)
/usr/local/lib/ruby/gems/2.3.0/gems/leather-3.5.1/lib/leather/action_controller_extension.rb:7:in `block in <module:ActionControllerExtension>': undefined method `helper_method' for ActionController::API:Class (NoMethodError)
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/concern.rb:120:in `class_eval'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/concern.rb:120:in `append_features'
from /usr/local/lib/ruby/gems/2.3.0/gems/leather-3.5.1/lib/leather/railtie.rb:11:in `include'
from /usr/local/lib/ruby/gems/2.3.0/gems/leather-3.5.1/lib/leather/railtie.rb:11:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:43:in `instance_eval'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:43:in `execute_hook'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:49:in `each'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
from /usr/local/lib/ruby/gems/2.3.0/gems/actionpack-5.0.1/lib/action_controller/api.rb:145:in `<class:API>'
from /usr/local/lib/ruby/gems/2.3.0/gems/actionpack-5.0.1/lib/action_controller/api.rb:88:in `<module:ActionController>'
from /usr/local/lib/ruby/gems/2.3.0/gems/actionpack-5.0.1/lib/action_controller/api.rb:5:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in `require'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in `require'
from /usr/local/lib/ruby/gems/2.3.0/gems/jbuilder-2.6.1/lib/jbuilder/railtie.rb:20:in `block (2 levels) in <class:Railtie>'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:43:in `instance_eval'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:43:in `execute_hook'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:33:in `block in on_load'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:32:in `each'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/lazy_load_hooks.rb:32:in `on_load'
from /usr/local/lib/ruby/gems/2.3.0/gems/jbuilder-2.6.1/lib/jbuilder/railtie.rb:19:in `block in <class:Railtie>'
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/initializable.rb:30:in `run'
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
from /usr/local/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /usr/local/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /usr/local/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /usr/local/lib/ruby/2.3.0/tsort.rb:347:in `each'
from /usr/local/lib/ruby/2.3.0/tsort.rb:347:in `call'
from /usr/local/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
from /usr/local/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
from /usr/local/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/application.rb:352:in `initialize!'
from /myapp/config/environment.rb:5:in `<top (required)>'
from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in `require'
from /usr/local/lib/ruby/gems/2.3.0/gems/storytime-2.1.6/lib/storytime/cli/install.rb:63:in `interactive'
from /usr/local/lib/ruby/gems/2.3.0/gems/storytime-2.1.6/lib/storytime/cli.rb:19:in `install'
from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
from /usr/local/lib/ruby/gems/2.3.0/gems/storytime-2.1.6/bin/storytime:4:in `<top (required)>'
from /usr/local/bin/storytime:22:in `load'
from /usr/local/bin/storytime:22:in `<main>'
Thanks
It seems like it conflicts with:
gem "rails3-jquery-autocomplete"
gem "meta-tags"
gem "twitter-bootstrap-rails"
gem 'activeadmin', github: 'activeadmin'
gem 'inherited_resources', github: 'activeadmin/inherited_resources'
+1
+1
+1
Like @testa19 reported, the problem could be in gem leather-3.5.1
. I found a possible solution Envek/monban@581698f.
I modified :
/usr/local/lib/ruby/gems/2.4.0/gems/leather-3.5.1/lib/leather/action_controller_extension.rb
like the above link indicates:
- Original
helper_method :current_tab, :current_tab?
- Modified
if respond_to?(:helper_method)
helper_method :current_tab, :current_tab?
end
and the bug disappeared.
For those who come late: I solved the problem adding this to the Gemfile:
gem 'leather', git: 'https://github.com/CultivateLabs/leather.git'
The original author of the gem merged this change, but didn't publish it yet as a gem