dvandersluis / amcharts.rb

Ruby/Rails wrapper for Amcharts
MIT License
12 stars 9 forks source link

undefined method `helper' for ActionController::API:Class #10

Open sergey-koba-mobidev opened 6 years ago

sergey-koba-mobidev commented 6 years ago

Hello, I have a strange issue after adding draper gem:

/usr/local/bundle/gems/amcharts.rb-3.11.2.17/lib/amcharts.rb:27:in `block (3 levels) in <module:AmCharts>': undefined method `helper' for ActionController::API:Class (NoMethodError)
        from /usr/local/bundle/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:43:in `instance_eval'
        from /usr/local/bundle/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:43:in `execute_hook'
        from /usr/local/bundle/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:33:in `block in on_load'
        from /usr/local/bundle/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:32:in `each'
        from /usr/local/bundle/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:32:in `on_load'
        from /usr/local/bundle/gems/amcharts.rb-3.11.2.17/lib/amcharts.rb:26:in `block (2 levels) in <module:AmCharts>'
        from /usr/local/bundle/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `instance_exec'
        from /usr/local/bundle/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `run'
        from /usr/local/bundle/gems/railties-5.0.2/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/bundle/gems/railties-5.0.2/lib/rails/initializable.rb:54:in `run_initializers'
        from /usr/local/bundle/gems/railties-5.0.2/lib/rails/application.rb:352:in `initialize!'
        from /app/config/environment.rb:5:in `<top (required)>'
        from /app/config.ru:3:in `require_relative'
        from /app/config.ru:3:in `block in <main>'
        from /usr/local/bundle/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
        from /usr/local/bundle/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
        from /app/config.ru:in `new'
        from /app/config.ru:in `<main>'
        from /usr/local/bundle/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
        from /usr/local/bundle/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
        from /usr/local/bundle/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
        from /usr/local/bundle/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
        from /usr/local/bundle/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
        from /usr/local/bundle/gems/railties-5.0.2/lib/rails/commands/server.rb:59:in `app'
        from /usr/local/bundle/gems/rack-2.0.1/lib/rack/server.rb:353:in `wrapped_app'
        from /usr/local/bundle/gems/railties-5.0.2/lib/rails/commands/server.rb:124:in `log_to_stdout'
        from /usr/local/bundle/gems/railties-5.0.2/lib/rails/commands/server.rb:77:in `start'
        from /usr/local/bundle/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:90:in `block in server'
        from /usr/local/bundle/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `tap'
        from /usr/local/bundle/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `server'
        from /usr/local/bundle/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
        from /usr/local/bundle/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
        from /app/bin/rails:9:in `require'
        from /app/bin/rails:9:in `<top (required)>'
        from /usr/local/bundle/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `load'
        from /usr/local/bundle/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `call'
        from /usr/local/bundle/gems/spring-2.0.1/lib/spring/client/command.rb:7:in `call'
        from /usr/local/bundle/gems/spring-2.0.1/lib/spring/client.rb:30:in `run'
        from /usr/local/bundle/gems/spring-2.0.1/bin/spring:49:in `<top (required)>'
        from /usr/local/bundle/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `load'
        from /usr/local/bundle/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `<top (required)>'
        from /app/bin/spring:15:in `require'
        from /app/bin/spring:15:in `<top (required)>'
        from bin/rails:3:in `load'
        from bin/rails:3:in `<main>'

I think it could be solved by replacing line 27 in lib/amcharts.rb was

helper AmCharts::AmChartsHelper

should be

::ActionController::Base.helper AmCharts::AmChartsHelper