Skip to content

Rails 5 API: undefined method `helper_method' for ActionController::API:Class (NoMethodError) #3690

Closed

Description

Activity

  1. jeffdill2 commented on Aug 9, 2015

    @jeffdill2

    @ballPointPenguin have you found any resolution or workaround for this issue?

  2. ballPointPenguin commented on Aug 11, 2015

    @ballPointPenguin
    Author

    @jeffdill2 this is working for me rails/rails#21151,
    but it may be that a devise-side solution would be nicer.

  3. FanaHOVA commented on Aug 20, 2015

    @FanaHOVA

    @ballPointPenguin Just used your Rails 5 fork and it works perfectly, thanks a lot for the fix.

  4. ballPointPenguin commented on Aug 20, 2015

    @ballPointPenguin
    Author

    @FanaHOVA glad I could help 😄

  5. nahaylo commented on Aug 27, 2015

    @nahaylo

    @ballPointPenguin, checked your fix. And yes, now, helper_method doesn't appear, but still devise doesn't work, because devise defines a lot of methods which behave as a helper method, for e.g.: authenticate_user!, current_user.
    Any ideas, how it could be fixed/done?
    Thanks

  6. ballPointPenguin commented on Aug 27, 2015

    @ballPointPenguin
    Author

    @nahaylo unfortunately, no. I haven't spent the effort getting devise working this way, beyond just clearing the initial failure addressed here.
    IMO, more work could be done on devise to make it "api-friendly", so to speak.

  7. jeffdill2 commented on Aug 27, 2015

    @jeffdill2

    @ballPointPenguin @nahaylo if you guys need another solution, I've been using https://github.com/simplabs/rails_api_auth and it's working very well. Very lightweight - i.e. well-suited for an API-only application.

  8. betesh commented on Aug 31, 2015

    @betesh
    Contributor

    PR #3732 fixes the helper_method issue.

    Also, I have made devise work with Sinatra before, with surprisingly little monkey-patching, but it would still have been nicer if this was supported from the start. If anyone is planning on overhauling devise to be more RailsApi friendly, I strongly encourage you to focus on a more generalized approach of making it more friendly to Rack-based applications in general. Please let me know if I can help out, especially in identifying where it needed to be tweaked for Sinatra.

  9. lucasmazza commented on Sep 26, 2015

    @lucasmazza
    Contributor

    Closed by #3732.

  10. dizo1 commented on Jun 4, 2017

    @dizo1

    Having the same issue could someone help?

  11. dizo1 commented on Jun 4, 2017

    @dizo1

    2017-06-04 03:19:52 +0000: Rack app error handling request { GET / }
    #<NoMethodError: undefined method helper_method' for ActionController::API:Class> /usr/local/rvm/gems/ruby-2.3.3/gems/google-webfonts-rails-0.0.1/lib/google-webfonts/rails/helpers.rb:7:in block in module:Helpers'
    /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/concern.rb:120:in class_eval' /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/concern.rb:120:in append_features'
    /usr/local/rvm/gems/ruby-2.3.3/gems/google-webfonts-rails-0.0.1/lib/google-webfonts-rails.rb:9:in include' /usr/local/rvm/gems/ruby-2.3.3/gems/google-webfonts-rails-0.0.1/lib/google-webfonts-rails.rb:9:in block in <top (required)>'
    /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/lazy_load_hooks.rb:43:in instance_eval' /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/lazy_load_hooks.rb:43:in execute_hook'
    /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/lazy_load_hooks.rb:50:in block in run_load_hooks' /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/lazy_load_hooks.rb:49:in each'
    /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/lazy_load_hooks.rb:49:in run_load_hooks' /usr/local/rvm/gems/ruby-2.3.3/gems/actionpack-5.0.3/lib/action_controller/api.rb:145:in class:API'
    /usr/local/rvm/gems/ruby-2.3.3/gems/actionpack-5.0.3/lib/action_controller/api.rb:88:in <module:ActionController>' /usr/local/rvm/gems/ruby-2.3.3/gems/actionpack-5.0.3/lib/action_controller/api.rb:5:in <top (required)>'
    /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in require' /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in block in require'
    /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:259:in load_dependency' /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in require'
    /usr/local/rvm/gems/ruby-2.3.3/gems/jbuilder-2.6.4/lib/jbuilder/railtie.rb:20:in block (2 levels) in <class:Railtie>' /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/lazy_load_hooks.rb:43:in instance_eval'
    /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/lazy_load_hooks.rb:43:in execute_hook' /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/lazy_load_hooks.rb:50:in block in run_load_hooks'
    /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/lazy_load_hooks.rb:49:in each' /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/lazy_load_hooks.rb:49:in run_load_hooks'
    /usr/local/rvm/gems/ruby-2.3.3/gems/actionpack-5.0.3/lib/action_controller/base.rb:269:in <class:Base>' /usr/local/rvm/gems/ruby-2.3.3/gems/actionpack-5.0.3/lib/action_controller/base.rb:164:in module:ActionController'
    /usr/local/rvm/gems/ruby-2.3.3/gems/actionpack-5.0.3/lib/action_controller/base.rb:5:in <top (required)>' /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in require'
    /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in block in require' /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:259:in load_dependency'
    /usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in require' /usr/local/rvm/gems/ruby-2.3.3/gems/actionpack-5.0.3/lib/action_dispatch/middleware/static.rb:77:in ext'
    /usr/local/rvm/gems/ruby-2.3.3/gems/actionpack-5.0.3/lib/action_dispatch/middleware/static.rb:33:in match?' /usr/local/rvm/gems/ruby-2.3.3/gems/actionpack-5.0.3/lib/action_dispatch/middleware/static.rb:130:in call'
    /usr/local/rvm/gems/ruby-2.3.3/gems/rack-2.0.3/lib/rack/sendfile.rb:111:in call' /usr/local/rvm/gems/ruby-2.3.3/gems/railties-5.0.3/lib/rails/engine.rb:522:in call'
    /usr/local/rvm/gems/ruby-2.3.3/gems/puma-3.8.2/lib/puma/configuration.rb:224:in call' /usr/local/rvm/gems/ruby-2.3.3/gems/puma-3.8.2/lib/puma/server.rb:600:in handle_request'
    /usr/local/rvm/gems/ruby-2.3.3/gems/puma-3.8.2/lib/puma/server.rb:435:in process_client' /usr/local/rvm/gems/ruby-2.3.3/gems/puma-3.8.2/lib/puma/server.rb:299:in block in run'
    /usr/local/rvm/gems/ruby-2.3.3/gems/puma-3.8.2/lib/puma/thread_pool.rb:120:in `block in spawn_thread'

  12. abadfish commented on Sep 20, 2017

    @abadfish

    I had this working ( helper_method :authenticate_token!, :current_user ) and then swapped out jbuilder for active_model_serializers. I got the error noted above so I added back jbuilder and now my api is working as expected with JWT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions