I am moving my rails application to rails only api but jbuilder is returning a blank screen
I check all of the previous talks about the same problem , I suppose to solve it with include ActionView::Rendering but when I include it, I get a different error saying undefined method 'include?"
/Users/mac/.rvm/gems/ruby-2.7.0/gems/actionpack-6.1.4.1/lib/abstract_controller/helpers.rb:148:in block in helper': undefined method include?' for nil:NilClass (NoMethodError)
class ApplicationController < ActionController::API include ActionController::RequestForgeryProtection include JSONAPI::ActsAsResourceController include ActionController::Helpers include ActionController::Cookies include ActionController::ImplicitRender include ActionView::Rendering
protect_from_forgery unless: -> { request.format.json? || request.format.xml? } after_action :flash_to_headers before_action :store_current_location, :unless => :devise_controller? before_action :flow_filter before_action :configure_permitted_parameters, if: :devise_controller? before_action :check_temporary_user, if: :devise_controller? before_action :authenticate_and_set_user before_action :authenticate_author_sdk before_action :authorize_user_or_author_access_token? before_action :underscore_params! respond_to :json end
there is no one to response ?
@hassanrbh could you provide more information about the issue you are facing? Ideally a repo that shows the problem... there is not enough to go by to comment on what's going wrong
Looking at the source of the error it seems _helpers is nil.
https://github.com/rails/rails/blob/6-1-stable/actionpack/lib/abstract_controller/helpers.rb#L148
Could you post the whole backtrace of the error?
@p8 yeah sure dude, one minute
@p8 her is it
Traceback (most recent call last):
95: from bin/rails:4:in <main>' 94: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require'
93: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi' 92: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register'
91: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi' 90: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require'
89: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/commands.rb:18:in <main>' 88: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/command.rb:48:in invoke'
87: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/command/base.rb:69:in perform' 86: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in dispatch'
85: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in invoke_command' 84: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in run'
83: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/commands/server/server_command.rb:135:in perform' 82: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/commands/server/server_command.rb:135:in tap'
81: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/commands/server/server_command.rb:144:in block in perform' 80: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/commands/server/server_command.rb:37:in start'
79: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/commands/server/server_command.rb:77:in log_to_stdout' 78: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/rack-2.2.3/lib/rack/server.rb:422:in wrapped_app'
77: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/rack-2.2.3/lib/rack/server.rb:249:in app' 76: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/rack-2.2.3/lib/rack/server.rb:349:in build_app_and_options_from_config'
75: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in parse_file' 74: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in load_file'
73: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in new_from_string' 72: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in eval'
71: from config.ru:3:in block in <main>' 70: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in require'
69: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in load_dependency' 68: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in block in require'
67: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' 66: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi'
65: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' 64: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi'
63: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' 62: from /Users/mac/Desktop/work/inara-dev/config/environment.rb:5:in initialize!' 60: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:60:in run_initializers'
59: from /Users/mac/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:205:in tsort_each' 58: from /Users/mac/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:226:in tsort_each'
57: from /Users/mac/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:347:in each_strongly_connected_component' 56: from /Users/mac/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:347:in call'
55: from /Users/mac/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:347:in each' 54: from /Users/mac/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:349:in block in each_strongly_connected_component'
53: from /Users/mac/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:431:in each_strongly_connected_component_from' 52: from /Users/mac/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component'
51: from /Users/mac/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/tsort.rb:228:in block in tsort_each' 50: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:61:in block in run_initializers'
49: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in run' 48: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in instance_exec'
47: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/application/finisher.rb:134:in block in <module:Finisher>' 46: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/application/finisher.rb:134:in each'
45: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/engine.rb:358:in eager_load!' 44: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/engine.rb:489:in eager_load!'
43: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/engine.rb:489:in each' 42: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/engine.rb:492:in block in eager_load!'
41: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/engine.rb:492:in each' 40: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/railties-6.1.4.1/lib/rails/engine.rb:493:in block (2 levels) in eager_load!'
39: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:288:in require_dependency' 38: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:375:in depend_on'
37: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:402:in require_or_load' 36: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:39:in load_interlock'
35: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies/interlock.rb:13:in loading' 34: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/share_lock.rb:151:in exclusive'
33: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies/interlock.rb:14:in block in loading' 32: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:39:in block in load_interlock'
31: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:419:in block in require_or_load' 30: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:522:in load_file'
29: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:715:in new_constants_in' 28: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:523:in block in load_file'
27: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in load' 26: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in load'
25: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/devise-4.8.0/app/controllers/devise/confirmations_controller.rb:3:in <main>' 24: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:213:in const_missing'
23: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:558:in load_missing_constant' 22: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:402:in require_or_load'
21: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:39:in load_interlock' 20: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies/interlock.rb:13:in loading'
19: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/share_lock.rb:151:in exclusive' 18: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies/interlock.rb:14:in block in loading'
17: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:39:in block in load_interlock' 16: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:419:in block in require_or_load'
15: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:522:in load_file' 14: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:715:in new_constants_in'
13: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:523:in block in load_file' 12: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in load'
11: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in load' 10: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/devise-4.8.0/app/controllers/devise_controller.rb:4:in inherited' 8: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/actionpack-6.1.4.1/lib/action_controller/railties/helpers.rb:7:in inherited'
7: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/actionpack-6.1.4.1/lib/abstract_controller/railties/routes_helpers.rb:9:in block (2 levels) in with' 6: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/actionpack-6.1.4.1/lib/abstract_controller/helpers.rb:51:in inherited'
5: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/actionpack-6.1.4.1/lib/abstract_controller/helpers.rb:51:in class_eval' 4: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/actionpack-6.1.4.1/lib/abstract_controller/helpers.rb:51:in block in inherited'
3: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/actionpack-6.1.4.1/lib/abstract_controller/helpers.rb:204:in default_helper_module!' 2: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/actionpack-6.1.4.1/lib/abstract_controller/helpers.rb:147:in helper'
1: from /Users/mac/.rvm/gems/ruby-2.7.0/gems/actionpack-6.1.4.1/lib/abstract_controller/helpers.rb:147:in each' /Users/mac/.rvm/gems/ruby-2.7.0/gems/actionpack-6.1.4.1/lib/abstract_controller/helpers.rb:148:in block in helper': undefined method `include?' for nil:NilClass (NoMethodError)