Unable to autoload constant ApplicationController(all controllers) - ruby-on-rails

I just started receiving this error for all controller.
Not sure what happened, because I was working on UI so CSS, ERB files and then I reload the page and start getting this error.
Thanks for any advice and help.
Controllers: (app/controllers/...)
home_controller.rb
application_controller.rb
In home_controller:
class HomeController < ApplicationController
def index
end
end
In application_controller:
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
end
Routes:
Rails.application.routes.draw do
devise_for :admins, path: '', path_names: { sign_in: 'login', sign_out: 'logout'}
# HOME
root to: 'home#index'
# MESSENGER
match '/webhook', :controller => 'messenger', :action => 'callback', :via => :post
get '/webhook' => 'messenger#verify_callback'
end
Error: (for all controllers same error except constant and path)
LoadError (Unable to autoload constant HomeController, expected /home/ubuntu/line/app/controllers/home_controller.rb to define it):
activesupport (5.0.1) lib/active_support/dependencies.rb:512:in `load_missing_constant'
activesupport (5.0.1) lib/active_support/dependencies.rb:203:in `const_missing'
activesupport (5.0.1) lib/active_support/inflector/methods.rb:268:in `const_get'
activesupport (5.0.1) lib/active_support/inflector/methods.rb:268:in `block in constantize'
activesupport (5.0.1) lib/active_support/inflector/methods.rb:266:in `each'
activesupport (5.0.1) lib/active_support/inflector/methods.rb:266:in `inject'
activesupport (5.0.1) lib/active_support/inflector/methods.rb:266:in `constantize'
activesupport (5.0.1) lib/active_support/dependencies.rb:583:in `get'
activesupport (5.0.1) lib/active_support/dependencies.rb:614:in `constantize'
actionpack (5.0.1) lib/action_dispatch/http/request.rb:81:in `controller_class'
actionpack (5.0.1) lib/action_dispatch/routing/route_set.rb:44:in `controller'
actionpack (5.0.1) lib/action_dispatch/routing/route_set.rb:30:in `serve'
actionpack (5.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.1) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.1) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call'
warden (1.2.7) lib/warden/manager.rb:36:in `block in call'
warden (1.2.7) lib/warden/manager.rb:35:in `catch'
warden (1.2.7) lib/warden/manager.rb:35:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.0.1) lib/active_record/migration.rb:553:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.4.0) lib/web_console/middleware.rb:20:in `block in call'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.0.1) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.1) lib/rails/engine.rb:522:in `call'
/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:152:in `accept_and_process_next_request'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:113:in `main_loop'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads'
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'
Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (3.1ms)
Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.3ms)
Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.8ms)
Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (20.3ms)
Started POST "/webhook" for 66.220.152.184 at 2017-02-20 04:02:49 +0000
Cannot render console from 66.220.152.184! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
LoadError (Unable to autoload constant ApplicationController, expected /home/ubuntu/line/app/controllers/application_controller.rb to define it):
app/controllers/messenger_controller.rb:3:in `<top (required)>'
Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (3.2ms)
Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.6ms)
Rendering /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.1ms)
Rendered /home/ubuntu/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (22.7ms)

This is not a routes issue. The problem is a constant resolution issue (plus autoloading) because it is saying it's not finding the HomeController class in home_controller.rb, despite the fact that it's defined there.
Try restarting the server process. Even though autoloading should handle any changes to classes, sometimes I've seen it fail. I've also seen the same issue happen with the spring preloader.
If this doesn't work, can you let us know whether you're using an IDE, and what happens if you try to interact with the ApplicationController class within the console.

As you mentioned that all your controllers are giving this error please check in file application.rb and add this line or a similar to below
config.autoload_paths += %W(#{config.root}/controllers)
The above may be because of some change in your application.rb your getting this error which is preventing it from auto loading all your controllers

I'm using C9 and ssh for AWS server.. The problem was in C9, because it didn't sync the files well, so when I close the file and reopen it, the files were empty..
In case if someone is using C9 and will have the same problem as me.

Related

Ruby on Rails exceptions from reserved keywords

I keep bumping into exception errors that I believe are due to conflicts from reserved keywords.
For example, I have a permit model with the attribute "gross_value" When my view tries to retrieve #permit.gross_value I get the following exception error. However, when I rename the attribute to #permit.value_gross (without changing anything else) the view works fine. I've had similar issues with other attribute names.
Is my diagnosis of the reason for the exception correct? How do I know what keywords to avoid this issue?
UPDATE: In the console when I try to access the attribute "total_weight" from the "permit" model e.g. "Permit.first.total_weight" I get a "stack level too deep" error message. When I rename the attribute from "total_weight" to "total_weigh" it works fine e.g. "Permit.first.total_weigh".
After renaming the attribute I still get the stack level too deep error message when trying to access "Permit.first.total_weight", which is curious because now the attribute does not exist so I expect to get a "undefined method" error as I do with other models e.g. "User.first.total_weight."
For now I am fine to make do with renaming my attribute to "total_weigh" - this has resolved the issue and everything is running smoothly. I'm just curious as to the reasoning and whether my diagnosis of a reserved keyword conflict is correct?
fatal (exception reentered):
actionpack (5.0.1) lib/action_controller/metal/rescue.rb:23:in `rescue in process_action'
actionpack (5.0.1) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.0.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.0.1) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (5.0.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.0.1) lib/active_support/notifications.rb:164:in `instrument'
actionpack (5.0.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.0.1) lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
activerecord (5.0.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (5.0.1) lib/abstract_controller/base.rb:126:in `process'
actionview (5.0.1) lib/action_view/rendering.rb:30:in `process'
actionpack (5.0.1) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (5.0.1) lib/action_controller/metal.rb:262:in `dispatch'
actionpack (5.0.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (5.0.1) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (5.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.1) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.1) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.0.1) lib/active_record/migration.rb:553:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.1.1) lib/web_console/middleware.rb:131:in `call_app'
web-console (3.1.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.1.1) lib/web_console/middleware.rb:18:in `catch'
web-console (3.1.1) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.1) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.0.1) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.1) lib/rails/engine.rb:522:in `call'
puma (3.4.0) lib/puma/configuration.rb:224:in `call'
puma (3.4.0) lib/puma/server.rb:569:in `handle_request'
puma (3.4.0) lib/puma/server.rb:406:in `process_client'
puma (3.4.0) lib/puma/server.rb:271:in `block in run'
puma (3.4.0) lib/puma/thread_pool.rb:114:in `block in spawn_thread'
Thanks for your help!
Simon
Are you doing any recursive calls in your code? This error usually means that you have re-entered a recursive call in your code.
Check your callbacks(i.e. before_save, before_validation etc.), if you have any, as these are common places where this can occur.

Unable to use CanCanCan with ActiveAdmin and Devise undefined method `dashboards' for #<AdminUser>

I'm constructing an admin panel with active admin
I've installed the three gems
gem 'activeadmin', github: 'activeadmin'
gem 'devise'
gem 'cancancan'
I set it up as follows:
rails g active_admin:install # Created a nice admin panel, with AdminUser Model
rails generate active_admin:resource MyModel # Added all my models
config/active_admin.rb
config.authorization_adapter = ActiveAdmin::CanCanAdapter
config.cancan_ability_class = Ability
config.authentication_method = :authenticate_admin_user!
ability.rb
class Ability
include CanCan::Ability
def initialize(user)
if user.admin?
can :read, ActiveAdmin::Page, :name => "Dashboard"
else
can :read, ActiveAdmin::Page, :name => "Dashboard"
end
end
end
and I also defined nice custom methods using formtastic, like index, show, edit, etc. methods for all my resource models I generated for active admin.
For example, my admin/dashboard.rb
ActiveAdmin.register_page "Dashboard" do
menu priority: 1, label: proc{ I18n.t("active_admin.dashboard") }
# some tables to display
content title: proc{ I18n.t("active_admin.dashboard") } do
div class: "blank_slate_container", id: "dashboard_default_message" do
columns do
column do
panel "Latest Visitors" do
# table_for Visitor('id desc').limit(10) do
table_for Patient.order("id desc").limit(10) do
column(:name)
column(:mobile)
end
end
end
end # columns
end
end # content
controller do
# before_action :authenticate_admin_user!
load_and_authorize_resource :through => :current_admin_user
end
end
The app runs fine if I comment out load_and_authorize_resource, a nice login system, which shows dashboard on successful log in details.
But when I use "load_and_authorize_resource", it throws an error when I load https://mywebsite/admin saying
NoMethodError in Admin::DashboardController#index
undefined method `dashboards' for #<AdminUser:0x007f0afd642878>
The method initialize seems to be working fine. But it somehow doesn't redirect back properly to the dashboard.
I didn't specifically use devise, but when I ran rails g active_admin:install initially, when setting up activeadmin, it automatically used devise, done as per the activeadmin documentation.
Update Stack trace:
Processing by Admin::DashboardController#index as HTML
AdminUser Load (50.8ms) SELECT "admin_users".* FROM "admin_users" WHERE "admin_users"."id" = $1 ORDER BY "admin_users"."id" ASC LIMIT $2 [["id", 2], ["LIMIT", 1]]
Completed 500 Internal Server Error in 106ms (ActiveRecord: 50.8ms)
NoMethodError (undefined method `dashboards' for #<AdminUser:0x000000063c4fa0>):
activemodel (5.0.6) lib/active_model/attribute_methods.rb:433:in `method_missing'
cancancan (2.0.0) lib/cancan/controller_resource.rb:201:in `resource_base_through'
cancancan (2.0.0) lib/cancan/controller_resource.rb:190:in `resource_base'
cancancan (2.0.0) lib/cancan/controller_resource.rb:72:in `load_collection?'
cancancan (2.0.0) lib/cancan/controller_resource.rb:36:in `load_resource'
cancancan (2.0.0) lib/cancan/controller_resource.rb:28:in `load_and_authorize_resource'
cancancan (2.0.0) lib/cancan/controller_resource.rb:12:in `block in add_before_action'
activesupport (5.0.6) lib/active_support/callbacks.rb:398:in `instance_exec'
activesupport (5.0.6) lib/active_support/callbacks.rb:398:in `block in make_lambda'
activesupport (5.0.6) lib/active_support/callbacks.rb:169:in `block (2 levels) in halting'
actionpack (5.0.6) lib/abstract_controller/callbacks.rb:12:in `block (2 levels) in <module:Callbacks>'
activesupport (5.0.6) lib/active_support/callbacks.rb:170:in `block in halting'
activesupport (5.0.6) lib/active_support/callbacks.rb:454:in `block in call'
activesupport (5.0.6) lib/active_support/callbacks.rb:454:in `each'
activesupport (5.0.6) lib/active_support/callbacks.rb:454:in `call'
activesupport (5.0.6) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
activesupport (5.0.6) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
activesupport (5.0.6) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.6) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.0.6) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.0.6) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.0.6) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (5.0.6) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.0.6) lib/active_support/notifications.rb:164:in `instrument'
actionpack (5.0.6) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.0.6) lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
activerecord (5.0.6) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (5.0.6) lib/abstract_controller/base.rb:126:in `process'
actionview (5.0.6) lib/action_view/rendering.rb:30:in `process'
actionpack (5.0.6) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (5.0.6) lib/action_controller/metal.rb:262:in `dispatch'
actionpack (5.0.6) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (5.0.6) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (5.0.6) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.6) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.6) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.6) lib/action_dispatch/routing/route_set.rb:727:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/rack/browser_monitoring.rb:32:in `traced_call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
warden (1.2.7) lib/warden/manager.rb:36:in `block in call'
warden (1.2.7) lib/warden/manager.rb:35:in `catch'
warden (1.2.7) lib/warden/manager.rb:35:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
rack (2.0.3) lib/rack/etag.rb:25:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
rack (2.0.3) lib/rack/conditional_get.rb:25:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
rack (2.0.3) lib/rack/head.rb:12:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
rack (2.0.3) lib/rack/session/abstract/id.rb:232:in `context'
rack (2.0.3) lib/rack/session/abstract/id.rb:226:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
actionpack (5.0.6) lib/action_dispatch/middleware/cookies.rb:613:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
activerecord (5.0.6) lib/active_record/migration.rb:553:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
actionpack (5.0.6) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.6) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.6) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.6) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.6) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
actionpack (5.0.6) lib/action_dispatch/middleware/executor.rb:12:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
actionpack (5.0.6) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
better_errors (2.4.0) lib/better_errors/middleware.rb:59:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
actionpack (5.0.6) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
web-console (3.5.1) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.5.1) lib/web_console/middleware.rb:20:in `block in call'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `catch'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
actionpack (5.0.6) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
railties (5.0.6) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.6) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.6) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.0.6) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.6) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.0.6) lib/rails/rack/logger.rb:24:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
actionpack (5.0.6) lib/action_dispatch/middleware/request_id.rb:24:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
rack (2.0.3) lib/rack/method_override.rb:22:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
rack (2.0.3) lib/rack/runtime.rb:22:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
activesupport (5.0.6) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
actionpack (5.0.6) lib/action_dispatch/middleware/executor.rb:12:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
actionpack (5.0.6) lib/action_dispatch/middleware/static.rb:136:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
rack (2.0.3) lib/rack/sendfile.rb:111:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
railties (5.0.6) lib/rails/engine.rb:522:in `call'
newrelic_rpm (4.5.0.337) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
puma (3.10.0) lib/puma/configuration.rb:225:in `call'
puma (3.10.0) lib/puma/server.rb:605:in `handle_request'
puma (3.10.0) lib/puma/server.rb:437:in `process_client'
puma (3.10.0) lib/puma/server.rb:301:in `block in run'
puma (3.10.0) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
Rendering /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
Rendering /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (4.6ms)
Rendering /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.2ms)
Rendering /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.0ms)
Rendered /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.0.6/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (35.2ms)
If you follow the steps for integrating Cancancan with ActiveAdmin, then you just have to extend Ability#initialize with your user roles as you need like so:
# app/models/ability.rb
def initialize(user)
if user.admin?
can :manage, :all
elsif user.product_manager?
can :manage, Product
can :read, ActiveAdmin::Page, name: 'Dashboard'
end
end
No need to invoke load_and_authorize_resource in each controller!

Disappearing Rails Controller

Rails keeps losing reference one of my controllers. If I restart the server, it will return, then after a bit of navigating, I'll get the uninitalized constant Controller error again...
I've never seen this error before.
Here's a dump of the rake:
admin_teams GET /admin/teams(.:format) admin/teams#index
POST /admin/teams(.:format) admin/teams#create
new_admin_team GET /admin/teams/new(.:format) admin/teams#new
edit_admin_team GET /admin/teams/:id/edit(.:format) admin/teams#edit
admin_team GET /admin/teams/:id(.:format) admin/teams#show
PATCH /admin/teams/:id(.:format) admin/teams#update
PUT /admin/teams/:id(.:format) admin/teams#update
DELETE /admin/teams/:id(.:format) admin/teams#destroy
Here's the routes:
namespace :admin do
resources :team_members
resources :organizations
resources :users
resources :teams
end
the controller:
module Admin
class TeamsController < Admin::AdminController
def index
#teams = Team.all
end
end
end
the views:
** Update **
Here's the log trace:
ActionController::RoutingError - uninitialized constant Admin::TeamsController:
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:270:in `const_get'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:270:in `block in constantize'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:266:in `each'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:266:in `inject'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:266:in `constantize'
actionpack (5.0.0.1) lib/action_dispatch/http/request.rb:93:in `controller_class'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:44:in `controller'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:30:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
airbrake (6.0.0) lib/airbrake/rack/middleware.rb:52:in `call'
better_errors (2.1.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:57:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.4.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `tagged'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.0.1) lib/rails/engine.rb:522:in `call'
puma (3.6.2) lib/puma/configuration.rb:225:in `call'
puma (3.6.2) lib/puma/server.rb:578:in `handle_request'
puma (3.6.2) lib/puma/server.rb:415:in `process_client'
puma (3.6.2) lib/puma/server.rb:275:in `block in run'
puma (3.6.2) lib/puma/thread_pool.rb:116:in `block in spawn_thread'

Rails uninitialized constant because of bad namespace coming out of nowhere

I randomly run into errors where my framework complains about a missing class because of a bad namespace.
For some reasons Rails will try to look for class name namespaced from a different gem :
Suppose I have a ::ProfilesController in my root namespace, I sometimes get errors of
uninitialized constant Mongoid::Token::Collisions::ProfilesController
Where Mongoid::Token::Collisions (an example) is a module from a different gem used in models. I have several profiles controller declared the following way
class ::ProfilesController < Devise::RegistrationsController
class Registrations::ProfilesController < Devise::RegistrationsController
class Foo::ProfilesController < FooController
class Bar::ProfilesController < BarController
class Baz::Foo::ProfilesController < BazController
I don't understand how it's even possible to resolve ProfileController with the Mongoid::Token::Collisions namespace since I never write in my code ProfilesController as is without any namespace or the :: prefix
I actually had similar errors with different components. Usually the problem would go away when restarting the server. I'm wondering what may cause this behavior, which became more frequent. I'm not sure providing code would be of any help, the stack trace doesn't even start from my application code. Any idea where this may come from ?
ActionController::RoutingError (uninitialized constant Mongoid::Token::Collisions::ProfilesController):
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:283:in `const_get'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:283:in `block in constantize'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:266:in `each'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:266:in `inject'
activesupport (5.0.0.1) lib/active_support/inflector/methods.rb:266:in `constantize'
actionpack (5.0.0.1) lib/action_dispatch/http/request.rb:93:in `controller_class'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:44:in `controller'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:30:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call'
rack-attack (5.0.1) lib/rack/attack.rb:147:in `call'
omniauth (1.3.2) lib/omniauth/strategy.rb:186:in `call!'
omniauth (1.3.2) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.3.2) lib/omniauth/strategy.rb:186:in `call!'
omniauth (1.3.2) lib/omniauth/strategy.rb:164:in `call'
rack-tracker (1.1.0) lib/rack/tracker.rb:34:in `call'
rack-utm (0.0.2) lib/rack-utm.rb:59:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.3.1) lib/web_console/middleware.rb:131:in `call_app'
web-console (3.3.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.3.1) lib/web_console/middleware.rb:18:in `catch'
web-console (3.3.1) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `tagged'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `call'
ahoy_matey (1.5.2) lib/ahoy/engine.rb:22:in `call_with_quiet_ahoy'
request_store (1.3.1) lib/request_store/middleware.rb:9:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
rack-cors (0.4.0) lib/rack/cors.rb:80:in `call'
railties (5.0.0.1) lib/rails/engine.rb:522:in `call'
puma (3.6.0) lib/puma/configuration.rb:225:in `call'
puma (3.6.0) lib/puma/server.rb:578:in `handle_request'
puma (3.6.0) lib/puma/server.rb:415:in `process_client'
puma (3.6.0) lib/puma/server.rb:275:in `block in run'
puma (3.6.0) lib/puma/thread_pool.rb:116:in `block in spawn_thread'

Ruby on rails Sunspot Solr weird error

Every time i make an action in my web application i get this enormous error which i really can't understand .
This console log is generated after i click "add to favorites" to one classified, which from the SQL side works fine.
After the click i get the error , but if i click "back" in my browser i see the item is "my favorite" .
The error follows :
Started PUT "/classifieds/72/favorite?type=favorite" for 127.0.0.1 at 2016-09-08 21:58:36 +0300
Processing by ClassifiedsController#favorite as HTML
Parameters: {"authenticity_token"=>"yynpSeBi2Jsr+GzGZZWbxmBCZSxXfOvG1NU9L3lX3pafRbtka779xUB18MkZUFPxtvQh7O4siIpPe5gl8XGbyQ==", "type"=>"favorite", "id"=>"72"}
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ? [["id", 4], ["LIMIT", 1]]
Classified Load (0.1ms) SELECT "classifieds".* FROM "classifieds" WHERE "classifieds"."id" = ? LIMIT ? [["id", 72], ["LIMIT", 1]]
(0.1ms) begin transaction
SOLR Request (4.4ms) [ path=update parameters={} ]
SQL (0.4ms) INSERT INTO "favorite_classifieds" ("user_id", "classified_id", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["user_id", 4], ["classified_id", 72], ["created_at", 2016-09-08 18:58:36 UTC], ["updated_at", 2016-09-08 18:58:36 UTC]]
(20.3ms) commit transaction
DEPRECATION WARNING: `redirect_to :back` is deprecated and will be removed from Rails 5.1. Please use `redirect_back(fallback_location: fallback_location)` where `fallback_location` represents the location to use if the request has no HTTP referer information. (called from favorite at /home/frcake/workspace/Site/brokerv1/brokr/app/controllers/classifieds_controller.rb:79)
Redirected to http://localhost:3000/classifieds/72
SOLR Request (12.5ms) [ path=update parameters={} ]
Completed 500 Internal Server Error in 50ms (ActiveRecord: 21.1ms)
RSolr::Error::Http (RSolr::Error::Http - 500 Internal Server Error
Error: 'java.nio.file.NoSuchFileException: /home/frcake/workspace/Site/brokerv1/brokr/solr/development/data/index/_41.fdt','trace'=>'java.lang.RuntimeException: java.nio.file.NoSuchFileException: /home/frcake/workspace/Site/brokerv1/brokr/solr/development/data/index/_41.fdt
URI: http://localhost:8982/solr/development/update?wt=ruby
Request Headers: {"Content-Type"=>"text/xml"}
Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><commit softCommit=\"false\"/>"
Backtrace: /home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rsolr-1.1.2/lib/rsolr/client.rb:288:in `adapt_response'
/home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rsolr-1.1.2/lib/rsolr/client.rb:189:in `execute'
/home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rsolr-1.1.2/lib/rsolr/client.rb:175:in `send_and_receive'
/home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/sunspot_rails-2.2.6/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
/home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications.rb:164:in `block in instrument'
/home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications.rb:164:in `instrument'
/home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/sunspot_rails-2.2.6/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
(eval):2:in `post'
/home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rsolr-1.1.2/lib/rsolr/client.rb:84:in `update'
/home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rsolr-1.1.2/lib/rsolr/client.rb:113:in `commit'):
rsolr (1.1.2) lib/rsolr/client.rb:288:in `adapt_response'
rsolr (1.1.2) lib/rsolr/client.rb:189:in `execute'
rsolr (1.1.2) lib/rsolr/client.rb:175:in `send_and_receive'
sunspot_rails (2.2.6) lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
activesupport (5.0.0.1) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (5.0.0.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.0.0.1) lib/active_support/notifications.rb:164:in `instrument'
sunspot_rails (2.2.6) lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
(eval):2:in `post'
rsolr (1.1.2) lib/rsolr/client.rb:84:in `update'
rsolr (1.1.2) lib/rsolr/client.rb:113:in `commit'
sunspot (2.2.6) lib/sunspot/session.rb:123:in `commit'
sunspot (2.2.6) lib/sunspot/session.rb:220:in `commit_if_dirty'
sunspot (2.2.6) lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `commit_if_dirty'
sunspot (2.2.6) lib/sunspot.rb:554:in `commit_if_dirty'
sunspot_rails (2.2.6) lib/sunspot/rails/request_lifecycle.rb:26:in `block (2 levels) in included'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:396:in `instance_exec'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:396:in `block in make_lambda'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:218:in `call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:218:in `block in halting'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:456:in `call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:456:in `block in call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:456:in `each'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:456:in `call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.0.0.1) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.0.0.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.0.0.1) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (5.0.0.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.0.0.1) lib/active_support/notifications.rb:164:in `instrument'
actionpack (5.0.0.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.0.0.1) lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
activerecord (5.0.0.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (5.0.0.1) lib/abstract_controller/base.rb:126:in `process'
actionview (5.0.0.1) lib/action_view/rendering.rb:30:in `process'
actionpack (5.0.0.1) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (5.0.0.1) lib/action_controller/metal.rb:262:in `dispatch'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:38:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.0.0.1) lib/active_record/migration.rb:552:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.3.1) lib/web_console/middleware.rb:131:in `call_app'
web-console (3.3.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.3.1) lib/web_console/middleware.rb:18:in `catch'
web-console (3.3.1) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `tagged'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.0.1) lib/rails/engine.rb:522:in `call'
puma (3.6.0) lib/puma/configuration.rb:225:in `call'
puma (3.6.0) lib/puma/server.rb:578:in `handle_request'
puma (3.6.0) lib/puma/server.rb:415:in `process_client'
puma (3.6.0) lib/puma/server.rb:275:in `block in run'
puma (3.6.0) lib/puma/thread_pool.rb:116:in `call'
puma (3.6.0) lib/puma/thread_pool.rb:116:in `block in spawn_thread'
Rendering /home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
Rendering /home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (9.4ms)
Rendering /home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (4.0ms)
Rendering /home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.5ms)
Rendered /home/frcake/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (36.3ms)
I followed this upvoted answer Can't reindex Sunspot SOLR - Error - RSolr::Error::Http - 500 Internal Server Error
instead of deleting the whole folder i just deleted the solr.xml file
All other commands are the same :)

Resources