RuntimeError Circular dependency detected while autoloading constant DeviseController
При нажатии на кнопки "Войти" и "Зарегистрироваться" появляется эта ошибка. В чем дело я понять не в силах,так как только начинаю в rails.
лог:
if loading.include?(expanded)
raise "Circular dependency detected while autoloading constant #{qualified_name}"
else
require_or_load(expanded, qualified_name)
raise LoadError, "Unable to autoload constant #{qualified_name}, expected #{file_path} to define it" unless from_mod.const_defined?(const_name, false)
activesupport (5.1.7) lib/active_support/dependencies.rb:509:in `load_missing_constant'
activesupport (5.1.7) lib/active_support/dependencies.rb:202:in `const_missing'
activesupport (5.1.7) lib/active_support/inflector/methods.rb:269:in `const_get'
activesupport (5.1.7) lib/active_support/inflector/methods.rb:269:in `block in constantize'
activesupport (5.1.7) lib/active_support/inflector/methods.rb:267:in `each'
activesupport (5.1.7) lib/active_support/inflector/methods.rb:267:in `inject'
activesupport (5.1.7) lib/active_support/inflector/methods.rb:267:in `constantize'
activesupport (5.1.7) lib/active_support/core_ext/string/inflections.rb:66:in `constantize'
devise (4.7.1) app/controllers/devise_controller.rb:4:in `<top (required)>'
activesupport (5.1.7) lib/active_support/dependencies.rb:477:in `load'
activesupport (5.1.7) lib/active_support/dependencies.rb:477:in `block in load_file'
activesupport (5.1.7) lib/active_support/dependencies.rb:662:in `new_constants_in'
activesupport (5.1.7) lib/active_support/dependencies.rb:476:in `load_file'
activesupport (5.1.7) lib/active_support/dependencies.rb:374:in `block in require_or_load'
activesupport (5.1.7) lib/active_support/dependencies.rb:36:in `block in load_interlock'
activesupport (5.1.7) lib/active_support/dependencies/interlock.rb:12:in `block in loading'
activesupport (5.1.7) lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
activesupport (5.1.7) lib/active_support/dependencies/interlock.rb:11:in `loading'
activesupport (5.1.7) lib/active_support/dependencies.rb:36:in `load_interlock'
activesupport (5.1.7) lib/active_support/dependencies.rb:357:in `require_or_load'
activesupport (5.1.7) lib/active_support/dependencies.rb:511:in `load_missing_constant'
activesupport (5.1.7) lib/active_support/dependencies.rb:202:in `const_missing'
devise (4.7.1) app/controllers/devise/registrations_controller.rb:3:in `<top (required)>'
activesupport (5.1.7) lib/active_support/dependencies.rb:477:in `load'
activesupport (5.1.7) lib/active_support/dependencies.rb:477:in `block in load_file'
activesupport (5.1.7) lib/active_support/dependencies.rb:662:in `new_constants_in'
activesupport (5.1.7) lib/active_support/dependencies.rb:476:in `load_file'
activesupport (5.1.7) lib/active_support/dependencies.rb:374:in `block in require_or_load'
activesupport (5.1.7) lib/active_support/dependencies.rb:36:in `block in load_interlock'
activesupport (5.1.7) lib/active_support/dependencies/interlock.rb:12:in `block in loading'
activesupport (5.1.7) lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
activesupport (5.1.7) lib/active_support/dependencies/interlock.rb:11:in `loading'
activesupport (5.1.7) lib/active_support/dependencies.rb:36:in `load_interlock'
activesupport (5.1.7) lib/active_support/dependencies.rb:357:in `require_or_load'
activesupport (5.1.7) lib/active_support/dependencies.rb:511:in `load_missing_constant'
activesupport (5.1.7) lib/active_support/dependencies.rb:202:in `const_missing'
activesupport (5.1.7) lib/active_support/inflector/methods.rb:271:in `const_get'
activesupport (5.1.7) lib/active_support/inflector/methods.rb:271:in `block in constantize'
activesupport (5.1.7) lib/active_support/inflector/methods.rb:267:in `each'
activesupport (5.1.7) lib/active_support/inflector/methods.rb:267:in `inject'
activesupport (5.1.7) lib/active_support/inflector/methods.rb:267:in `constantize'
activesupport (5.1.7) lib/active_support/dependencies.rb:583:in `get'
activesupport (5.1.7) lib/active_support/dependencies.rb:614:in `constantize'
actionpack (5.1.7) lib/action_dispatch/http/request.rb:85:in `controller_class_for'
actionpack (5.1.7) lib/action_dispatch/http/parameters.rb:99:in `binary_params_for?'
actionpack (5.1.7) lib/action_dispatch/http/parameters.rb:90:in `set_binary_encoding'
actionpack (5.1.7) lib/action_dispatch/http/parameters.rb:67:in `path_parameters='
actionpack (5.1.7) lib/action_dispatch/journey/router.rb:48:in `block in serve'
actionpack (5.1.7) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.7) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.7) lib/action_dispatch/routing/route_set.rb:844:in `call'
omniauth (1.9.1) lib/omniauth/strategy.rb:192:in `call!'
omniauth (1.9.1) lib/omniauth/strategy.rb:169:in `call'
omniauth (1.9.1) lib/omniauth/strategy.rb:192:in `call!'
omniauth (1.9.1) lib/omniauth/strategy.rb:169:in `call'
omniauth (1.9.1) lib/omniauth/builder.rb:45:in `call'
warden (1.2.8) lib/warden/manager.rb:36:in `block in call'
warden (1.2.8) lib/warden/manager.rb:34:in `catch'
warden (1.2.8) lib/warden/manager.rb:34:in `call'
rack (2.2.2) lib/rack/etag.rb:27:in `call'
rack (2.2.2) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.2) lib/rack/head.rb:12:in `call'
rack (2.2.2) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.2) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.1.7) lib/active_record/migration.rb:556:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
activesupport (5.1.7) lib/active_support/callbacks.rb:97:in `run_callbacks'
actionpack (5.1.7) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
web-console (3.7.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.7.0) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `catch'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.7) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.7) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.7) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.7) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.7) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.7) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.2.2) lib/rack/method_override.rb:24:in `call'
rack (2.2.2) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.7) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.2.2) lib/rack/sendfile.rb:110:in `call'
railties (5.1.7) lib/rails/engine.rb:522:in `call'
puma (3.12.4) lib/puma/configuration.rb:227:in `call'
puma (3.12.4) lib/puma/server.rb:675:in `handle_request'
puma (3.12.4) lib/puma/server.rb:476:in `process_client'
puma (3.12.4) lib/puma/server.rb:334:in `block in run'
puma (3.12.4) lib/puma/thread_pool.rb:135:in `block in spawn_thread'
Вот мой Post_controller:
class PostsController < ApplicationController
#http_basic_authenticate_with name: "admin", password: "admin", except: [:index, :show]
def index
@post = Post.all
end
def new
@post = Post.new
end
def show
@post = Post.find(params[:id])
end
def edit
@post = Post.find(params[:id])
end
def update
@post = Post.find(params[:id])
#authorize @post
if @post.update(post_params)
redirect_to @post
else
render 'edit'
end
end
def publish
@post = Post.find(params[:id])
authorize @post, :update?
@post.publish!
redirect_to @post
end
def destroy
#@post = Post.find(params[:id])
#@post = Post.destroy(params[:id])
#@post.destroy
redirect_to posts_path
end
def create
#render plain: [:post]params.inspect
@post = Post.new(post_params)
if @post.save
redirect_to @post
else
render 'new'
end
end
private def post_params
params.require(:post).permit(:title,:body)
end
end
мой ApplicationController:
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
#before_action :authenticate_user!
include Pundit
protect_from_forgery
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
helper_method :current_user
end
Мой Gemfile:
source 'http://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.7'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'bootsnap'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
gem 'rspec-rails', '~> 4.0.0'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'letter_opener'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'simple_form'
gem 'devise'
gem 'omniauth'
gem 'omniauth-facebook'
gem "pundit"