CultivateLabs / storytime

Storytime is a Rails 4+ CMS and blogging engine, with a core focus on content. It is built and maintained by @cultivatelabs
MIT License
752 stars 81 forks source link

undefined method `helper_method' for ActionController::API:Class (NoMethodError) #206

Open testa19 opened 7 years ago

testa19 commented 7 years ago

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 methodhelper_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

testa19 commented 7 years ago

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'

FerreiraRaphael commented 7 years ago

+1

aberios commented 7 years ago

+1

fbukevin commented 7 years ago

+1

fbukevin commented 7 years ago

Like @testa19 reported, the problem could be in gem leather-3.5.1. I found a possible solution https://github.com/Envek/monban/commit/581698f68e277866018c0448fcb28c0f97bdbb2c.

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:

and the bug disappeared.

danmaz74 commented 7 years ago

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