I am getting this error when trying to deploy my application on a linux server.
Versão servidor: PostgreSQL 9.3.4 on x86_64-pc-linux-gnu, compiled by x86_64-pc-linux-gnu-gcc (Gentoo 4.8.1-r1 p1.2, pie-0.5.7) 4.8.1, 64-bit
uninitialized constant ActionController::Routing (NameError)
/home/divulgapocos/apps_rails/divulgapocos/config/initializers/new_rails_defaults.rb:14:in `<top (required)>'
/opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:652:in `block in load_config_initializer'
/opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166:in `instrument'
/opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:651:in `load_config_initializer'
/opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
/opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:615:in `each'
/opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:615:in `block in <class:Engine>'
/opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec'
/opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'
/opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
/opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
/opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
/opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from'
/opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
/opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:209:in `block in each_strongly_connected_component_from'
/opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:44:in `each'
/opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:44:in `tsort_each_child'
/opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:203:in `each_strongly_connected_component_from'
/opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
/opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each'
/opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
/opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
/opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'
/opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'
/home/divulgapocos/apps_rails/divulgapocos/config/environment.rb:5:in `<top (required)>'
config.ru:3:in `require'
config.ru:3:in `block in <main>'
/opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.6.1/lib/rack/builder.rb:55:in `instance_eval'
/opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.6.1/lib/rack/builder.rb:55:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/opt/apx_passenger//helper-scripts/rack-preloader.rb:112:in `eval'
/opt/apx_passenger//helper-scripts/rack-preloader.rb:112:in `preload_app'
/opt/apx_passenger//helper-scripts/rack-preloader.rb:158:in `<module:App>'
/opt/apx_passenger//helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/opt/apx_passenger//helper-scripts/rack-preloader.rb:28:in `<main>'
My Gemfile looks like this
source 'https://rubygems.org'
gem 'rails', '4.2.1'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jquery-turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem "paperclip", "~> 4.2"
gem 'devise'
gem 'pg'
gem 'bootstrap-sass', '~> 3.3.4'
gem 'autoprefixer-rails'
gem 'masonry-rails', '~> 0.2.4'
gem 'devise-bootstrap-views'
gem 'paypal-recurring'
gem 'therubyracer'
gem 'activesupport'
gem 'railties'
gem 'rack'
group :development, :test do
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring'
end
You've updated this app from an older, 2.x version of Rails. You have a line in your config/initializers/new_rails_defaults.rb that uses the ActionController::Routing constant, that constant no longer exists in Rails 4.2.
So, basically, the fix here is to upgrade your app to 4.2 properly. I could tell you to remove the ActionController::Routing line from your file, but probably that's just one of many other issues you haven't fixed here.
The weird thing here is that you haven't mentioned having the same problems in dev, which suggests you're not actually using the version of Rails in dev that you think you are.
Good luck.
Related
in my development are the app works fine but when i deploy to heroku and try to run rake db:migrate to build the database, it aborts and says wrong number of arguments. i have searched all over the web but could not fix it.
here is the error
$ heroku run rake db:migrate
Running rake db:migrate on ⬢ blooming-dusk-86753... up, run.9621 (Free)
rake aborted!
ArgumentError: wrong number of arguments (given 3, expected 2)
/app/vendor/bundle/ruby/3.0.0/gems/activerecord-5.0.7.2/lib/active_record/type/adapter_specific_registry.rb:7:in `add_modifier'
/app/vendor/bundle/ruby/3.0.0/gems/activerecord-5.0.7.2/lib/active_record/type.rb:22:in `add_modifier'
/app/vendor/bundle/ruby/3.0.0/gems/activerecord-5.0.7.2/lib/active_record/connection_adapters/postgresql_adapter.rb:827:in `<class:PostgreSQLAdapter>'
/app/vendor/bundle/ruby/3.0.0/gems/activerecord-5.0.7.2/lib/active_record/connection_adapters/postgresql_adapter.rb:69:in `<module:ConnectionAdapters>'
/app/vendor/bundle/ruby/3.0.0/gems/activerecord-5.0.7.2/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `<module:ActiveRecord>'
/app/vendor/bundle/ruby/3.0.0/gems/activerecord-5.0.7.2/lib/active_record/connection_adapters/postgresql_adapter.rb:19:in `<top (required)>'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:293:in `require'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:293:in `block in require'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:259:in `load_dependency'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:293:in `require'
/app/vendor/bundle/ruby/3.0.0/gems/activerecord-5.0.7.2/lib/active_record/connection_adapters/connection_specification.rb:174:in `spec'
/app/vendor/bundle/ruby/3.0.0/gems/activerecord-5.0.7.2/lib/active_record/connection_handling.rb:53:in `establish_connection'
/app/vendor/bundle/ruby/3.0.0/gems/activerecord-5.0.7.2/lib/active_record/railtie.rb:125:in `block (2 levels) in <class:Railtie>'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/lazy_load_hooks.rb:49:in `each'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
/app/vendor/bundle/ruby/3.0.0/gems/activerecord-5.0.7.2/lib/active_record/base.rb:324:in `<module:ActiveRecord>'
/app/vendor/bundle/ruby/3.0.0/gems/activerecord-5.0.7.2/lib/active_record/base.rb:24:in `<top (required)>'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:293:in `require'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:293:in `block in require'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:259:in `load_dependency'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:293:in `require'
/app/app/models/user.rb:1:in `<top (required)>'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:293:in `require'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:293:in `block in require'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:259:in `load_dependency'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:293:in `require'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:380:in `block in require_or_load'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:37:in `block in load_interlock'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/concurrency/share_lock.rb:150:in `exclusive'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies/interlock.rb:11:in `loading'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:37:in `load_interlock'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:358:in `require_or_load'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:512:in `load_missing_constant'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:203:in `const_missing'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/inflector/methods.rb:268:in `const_get'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/inflector/methods.rb:268:in `block in constantize'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/inflector/methods.rb:266:in `each'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/inflector/methods.rb:266:in `inject'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/inflector/methods.rb:266:in `constantize'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:584:in `get'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:615:in `constantize'
/app/vendor/bundle/ruby/3.0.0/gems/devise-4.8.1/lib/devise.rb:318:in `get'
/app/vendor/bundle/ruby/3.0.0/gems/devise-4.8.1/lib/devise/mapping.rb:83:in `to'
/app/vendor/bundle/ruby/3.0.0/gems/devise-4.8.1/lib/devise/mapping.rb:78:in `modules'
/app/vendor/bundle/ruby/3.0.0/gems/devise-4.8.1/lib/devise/mapping.rb:95:in `routes'
/app/vendor/bundle/ruby/3.0.0/gems/devise-4.8.1/lib/devise/mapping.rb:162:in `default_used_route'
/app/vendor/bundle/ruby/3.0.0/gems/devise-4.8.1/lib/devise/mapping.rb:72:in `initialize'
/app/vendor/bundle/ruby/3.0.0/gems/devise-4.8.1/lib/devise.rb:354:in `new'
/app/vendor/bundle/ruby/3.0.0/gems/devise-4.8.1/lib/devise.rb:354:in `add_mapping'
/app/vendor/bundle/ruby/3.0.0/gems/devise-4.8.1/lib/devise/rails/routes.rb:243:in `block in devise_for'
/app/vendor/bundle/ruby/3.0.0/gems/devise-4.8.1/lib/devise/rails/routes.rb:242:in `each'
/app/vendor/bundle/ruby/3.0.0/gems/devise-4.8.1/lib/devise/rails/routes.rb:242:in `devise_for'
/app/config/routes.rb:2:in `block in <top (required)>'
/app/vendor/bundle/ruby/3.0.0/gems/actionpack-5.0.7.2/lib/action_dispatch/routing/route_set.rb:391:in `instance_exec'
/app/vendor/bundle/ruby/3.0.0/gems/actionpack-5.0.7.2/lib/action_dispatch/routing/route_set.rb:391:in `eval_block'
/app/vendor/bundle/ruby/3.0.0/gems/actionpack-5.0.7.2/lib/action_dispatch/routing/route_set.rb:373:in `draw'
/app/config/routes.rb:1:in `<top (required)>'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:287:in `load'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:287:in `block in load'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:259:in `load_dependency'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:287:in `load'
/app/vendor/bundle/ruby/3.0.0/gems/railties-5.0.7.2/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
/app/vendor/bundle/ruby/3.0.0/gems/railties-5.0.7.2/lib/rails/application/routes_reloader.rb:40:in `each'
/app/vendor/bundle/ruby/3.0.0/gems/railties-5.0.7.2/lib/rails/application/routes_reloader.rb:40:in `load_paths'
/app/vendor/bundle/ruby/3.0.0/gems/railties-5.0.7.2/lib/rails/application/routes_reloader.rb:16:in `reload!'
/app/vendor/bundle/ruby/3.0.0/gems/railties-5.0.7.2/lib/rails/application/routes_reloader.rb:26:in `block in updater'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/file_update_checker.rb:77:in `execute'
/app/vendor/bundle/ruby/3.0.0/gems/railties-5.0.7.2/lib/rails/application/routes_reloader.rb:27:in `updater'
/app/vendor/bundle/ruby/3.0.0/gems/railties-5.0.7.2/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
/app/vendor/bundle/ruby/3.0.0/gems/railties-5.0.7.2/lib/rails/application/finisher.rb:119:in `block in <module:Finisher>'
/app/vendor/bundle/ruby/3.0.0/gems/railties-5.0.7.2/lib/rails/initializable.rb:30:in `instance_exec'
/app/vendor/bundle/ruby/3.0.0/gems/railties-5.0.7.2/lib/rails/initializable.rb:30:in `run'
/app/vendor/bundle/ruby/3.0.0/gems/railties-5.0.7.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/app/vendor/bundle/ruby/3.0.0/gems/railties-5.0.7.2/lib/rails/initializable.rb:54:in `run_initializers'
/app/vendor/bundle/ruby/3.0.0/gems/railties-5.0.7.2/lib/rails/application.rb:352:in `initialize!'
/app/config/environment.rb:5:in `<top (required)>'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:293:in `require'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:293:in `block in require'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:259:in `load_dependency'
/app/vendor/bundle/ruby/3.0.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:293:in `require'
/app/vendor/bundle/ruby/3.0.0/gems/railties-5.0.7.2/lib/rails/application.rb:328:in `require_environment!'
/app/vendor/bundle/ruby/3.0.0/gems/railties-5.0.7.2/lib/rails/application.rb:448:in `block in run_tasks_blocks'
/app/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/app/bin/bundle:3:in `load'
/app/bin/bundle:3:in `<main>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
here is my gem file:
source 'https://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.0.7', '>= 5.0.7.2'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.3.13', group: [:development, :test]
# Use postgresql as the database for production
group :production do
gem 'pg', '~> 0.20'
gem 'rails_12factor'
end
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
#use bootsrtap for styles
gem 'bootstrap-sass', '~> 3.4.1'
#use font awesom for icons
gem 'font-awesome-sass', '~> 5.15.1'
#use devise for user logins
gem 'devise'
#use paperclip for images upload
gem 'paperclip'
gem 'jquery-rails'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# 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', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
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 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
i think the problem is related to sqlite3 vs postgresql(heroku) but i cant seem to fix it.
here is the github link:
https://github.com/fawzi-saab/S-Portfolio
if you are especially creating apps to deploy heroku its better to use postgresql in both development and production. I look into your repo and i think your config/database.yml file needs to be revised in order to connect to postgresql database. You can also check a documentation to deploy an app to heroku here
I uses Rails but it does not follow the settings in config/database.yml.
With config/database.yml ($DATABASE_URL is the URL of my Heroku app's database)
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
adapter: sqlite3
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
url: <%= ENV['DATABASE_URL'] %>
I ran rails g controller hoge, then I got errors:
/myapp/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/connection_specification.rb:188:in `rescue in spec': Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
from /myapp/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/connection_specification.rb:185:in `spec'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:880:in `establish_connection'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/connection_handling.rb:58:in `establish_connection'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/railtie.rb:124:in `block (2 levels) in <class:Railtie>'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:49:in `each'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/base.rb:326:in `<module:ActiveRecord>'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.6/lib/active_record/base.rb:25:in `<top (required)>'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:256:in `block in load_dependency'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:662:in `new_constants_in'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:256:in `load_dependency'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
from /myapp/app/models/application_record.rb:1:in `<top (required)>'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:477:in `load'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:477:in `block in load_file'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:662:in `new_constants_in'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:476:in `load_file'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:374:in `block in require_or_load'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:36:in `block in load_interlock'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies/interlock.rb:11:in `loading'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:36:in `load_interlock'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:357:in `require_or_load'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:511:in `load_missing_constant'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:202:in `const_missing'
from /myapp/app/models/user.rb:1:in `<top (required)>'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:477:in `load'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:477:in `block in load_file'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:662:in `new_constants_in'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:476:in `load_file'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:374:in `block in require_or_load'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:36:in `block in load_interlock'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies/interlock.rb:11:in `loading'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:36:in `load_interlock'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:357:in `require_or_load'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:511:in `load_missing_constant'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:202:in `const_missing'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/inflector/methods.rb:269:in `const_get'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/inflector/methods.rb:269:in `block in constantize'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/inflector/methods.rb:267:in `each'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/inflector/methods.rb:267:in `inject'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/inflector/methods.rb:267:in `constantize'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:583:in `get'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:614:in `constantize'
from /myapp/vendor/bundle/ruby/2.5.0/gems/devise-4.4.3/lib/devise.rb:316:in `get'
from /myapp/vendor/bundle/ruby/2.5.0/gems/devise-4.4.3/lib/devise/mapping.rb:83:in `to'
from /myapp/vendor/bundle/ruby/2.5.0/gems/devise-4.4.3/lib/devise/mapping.rb:78:in `modules'
from /myapp/vendor/bundle/ruby/2.5.0/gems/devise-4.4.3/lib/devise/mapping.rb:95:in `routes'
from /myapp/vendor/bundle/ruby/2.5.0/gems/devise-4.4.3/lib/devise/mapping.rb:162:in `default_used_route'
from /myapp/vendor/bundle/ruby/2.5.0/gems/devise-4.4.3/lib/devise/mapping.rb:72:in `initialize'
from /myapp/vendor/bundle/ruby/2.5.0/gems/devise-4.4.3/lib/devise.rb:346:in `new'
from /myapp/vendor/bundle/ruby/2.5.0/gems/devise-4.4.3/lib/devise.rb:346:in `add_mapping'
from /myapp/vendor/bundle/ruby/2.5.0/gems/devise-4.4.3/lib/devise/rails/routes.rb:243:in `block in devise_for'
from /myapp/vendor/bundle/ruby/2.5.0/gems/devise-4.4.3/lib/devise/rails/routes.rb:242:in `each'
from /myapp/vendor/bundle/ruby/2.5.0/gems/devise-4.4.3/lib/devise/rails/routes.rb:242:in `devise_for'
from /myapp/config/routes.rb:2:in `block in <top (required)>'
from /myapp/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:436:in `instance_exec'
from /myapp/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:436:in `eval_block'
from /myapp/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:418:in `draw'
from /myapp/config/routes.rb:1:in `<top (required)>'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `block in load'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'
from /myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application/routes_reloader.rb:55:in `block in load_paths'
from /myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application/routes_reloader.rb:55:in `each'
from /myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application/routes_reloader.rb:55:in `load_paths'
from /myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application/routes_reloader.rb:18:in `reload!'
from /myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application/routes_reloader.rb:41:in `block in updater'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/file_update_checker.rb:81:in `execute'
from /myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application/routes_reloader.rb:42:in `updater'
from /myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application/routes_reloader.rb:31:in `execute_if_updated'
from /myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application/finisher.rb:128:in `block in <module:Finisher>'
from /myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `instance_exec'
from /myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `run'
from /myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:59:in `block in run_initializers'
from /home/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
from /home/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /home/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /home/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /home/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:347:in `each'
from /home/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:347:in `call'
from /home/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
from /home/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
from /home/.rbenv/versions/2.5.0/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
from /myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:58:in `run_initializers'
from /myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application.rb:353:in `initialize!'
from /myapp/config/environment.rb:5:in `<top (required)>'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
from /myapp/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
from /myapp/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:102:in `preload'
from /myapp/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
from /myapp/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
from /myapp/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
from /myapp/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
from /myapp/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/.rbenv/versions/2.5.0/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from /home/.rbenv/versions/2.5.0/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from -e:1:in `<main>'
In Gemfile:
source 'https://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.4'
# 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', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
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.13'
gem 'selenium-webdriver'
gem 'pry-rails'
gem 'pry-doc'
gem 'pry-byebug'
gem 'pry-stack_explorer'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
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 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'letter_opener'
gem 'letter_opener_web'
end
group :production do
gem 'pg', '~> 0.20'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'config'
gem 'bootstrap-sass'
gem 'kaminari'
gem 'jquery-rails'
gem 'gon'
gem 'faraday'
gem 'faraday_middleware'
gem 'devise'
gem 'devise-bootstrap-views'
gem 'data-confirm-modal'
My ruby version is v2.5.0 and OS is macOS Sierra 10.12.6.
Why the adapter is set to postgresql in spite of sqlite3 in config/database.yml?
How can I use the configurations correctly?
I think of migrating developing environment to virtual box (to avoid cumbersome problems like this), but I am afraid that, in the box, I would get such errors as well. Is it OK?
Rails is using the connection details from the environment variable, not the config file. Rails uses both ENV['DATABASE_URL'] and config/database.yml when setting up the database, and in most cases the environment variable has priority.
Take a look at the docs to see how the two ways of configuring the database interact.
The simplest solution in your case is probably to remove the DATABASE_URL varaible from your development machine. It’s unlikely you need it set there, and could possibly cause problems if you accidentally connect to the production database from development.
You could also use the url: key rather than the database: key when specifying the development database, as that key does take precedence over the environment variable. It would look something like:
development:
<<: *default
url: sqlite:db/development.sqlite3
You should also probably remove the adapter from defaults, as you are not using sqlite in production but are merging in that key. What you have will likely work (since the environment variable overrides the setting in the file), but it is confusing. Ideally you would want to look into using the same database in development and production to minimise differences between the two environments.
So My Gemfile currently looks like
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'mathjax-rails', '~> 2.5', '>= 2.5.1'
gem 'bootstrap-sass', '~> 3.3', '>= 3.3.5.1'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
It works fine. Funny thing is, as soon as I remove mathjax-rails and try to run in production mode, I get
/usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.4/lib/action_dispatch/routing/url_for.rb:99:in `append_features': cyclic include detected (ArgumentError)
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.4/lib/action_dispatch/routing/url_for.rb:99:in `include'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.4/lib/action_dispatch/routing/url_for.rb:99:in `block in <module:UrlFor>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/concern.rb:120:in `class_eval'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/concern.rb:120:in `append_features'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionview-4.2.4/lib/action_view/railtie.rb:41:in `include'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionview-4.2.4/lib/action_view/railtie.rb:41:in `block (2 levels) in <class:Railtie>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.4/lib/action_controller/base.rb:266:in `<class:Base>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.4/lib/action_controller/base.rb:164:in `<module:ActionController>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.4/lib/action_controller/base.rb:5:in `<top (required)>'
from /root/StudySome/app/controllers/application_controller.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:360:in `require_or_load'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:317:in `depend_on'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:233:in `require_dependency'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/engine.rb:471:in `each'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/engine.rb:471:in `block in eager_load!'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/engine.rb:469:in `each'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/engine.rb:469:in `eager_load!'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/engine.rb:346:in `eager_load!'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/application/finisher.rb:56:in `each'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `run'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
from /root/StudySome/config/environment.rb:5:in `<top (required)>'
from /root/StudySome/config.ru:3:in `require'
from /root/StudySome/config.ru:3:in `block in <main>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
from /root/StudySome/config.ru:in `new'
from /root/StudySome/config.ru:in `<main>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/server.rb:61:in `app'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:272:in `start'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/server.rb:80:in `start'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
=> Booting WEBrick
=> Rails 4.2.4 application starting in production on http://159.203.240.211:80
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
Why?! I just want to load MathJax from the MathJax CDN...
Even though you removed the gem, you might have some mathjax references left in your code. In the usage instructions for the gem, it seems like you have to add some code to routes.rb as well as app/views/layouts/application.html.erb. If those references are there, removing them should fix this sissue.
I'm getting an error when I try to boot up WeBrick.
When I type rails server, I get the following error:
C:\Users\xxxx\Documents\Sites\simple_cms>rails s
=> Booting WEBrick
=> Rails 4.2.4 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_view/helpers.rb:40:in `<module:Helpers>': uninitialized constant ActionView::Helpers::ActiveModelHelper (NameError)
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_view/helpers.rb:4:in `<module:ActionView>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_view/helpers.rb:3:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_view/base.rb:5:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_view/view_paths.rb:1:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/abstract_controller/rendering.rb:4:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionmailer-4.2.4/lib/action_mailer/base.rb:423:in `<class:Base>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionmailer-4.2.4/lib/action_mailer/base.rb:417:in `<module:ActionMailer>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionmailer-4.2.4/lib/action_mailer/base.rb:9:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionmailer-4.2.4/lib/action_mailer/railtie.rb:59:in `block in <class:Railtie>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:36:in `call'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:44:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `instance_exec'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `run'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:55:in `block in run_initializers'
from C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:345:in `each'
from C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:345:in `call'
from C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
from C:/Users/xxxx/Documents/Sites/simple_cms/config/environment.rb:5:in `<top (required)>'
from C:/Users/xxxx/Documents/Sites/simple_cms/config.ru:3:in `require'
from C:/Users/xxxx/Documents/Sites/simple_cms/config.ru:3:in `block in <main>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
from C:/Users/xxxx/Documents/Sites/simple_cms/config.ru:in `new'
from C:/Users/xxxx/Documents/Sites/simple_cms/config.ru:in `<main>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands/server.rb:61:in `app'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands/server.rb:139:in `log_to_stdout'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands/server.rb:78:in `start'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Here is the Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use mysql as the database for Active Record
gem 'mysql2'
# Use SCSS for stylesheets
#gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
#gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
#gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
#gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
#gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
#gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
#gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
#group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
#gem 'byebug'
#end
#group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
#gem 'web-console', '~> 2.0'
#end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Can anybody help me fix this?
PS: I am running on Windows 10
Try adding this line to your Gemfile
gem 'rack', '~> 1.6.4'
and then run:
bundle install
and see if that fixes your issue.
Update
If the above does not work, try uninstalling railties gem. Then install an older version of the rails (rails version 4.0.0 was used in the from the tutorial). The issue is due to the version mismatch/incompatibility of some of your gems.
I'm working through chapter 3 of Michael Hartl's tutorial and I tried running "rails generate rspec:install" and I get the error message below.
C:\Sites\sample_app>rails generate rspec:install
DL is deprecated, please use Fiddle
C:/Sites/sample_app/config/environments/development.rb:1:in `<top (required)>':
undefined method `configure' for #<SampleApp::Application:0x380cda8> (NoMethodEr
ror)
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-
4.0.8/lib/active_support/dependencies.rb:229:in `require'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-
4.0.8/lib/active_support/dependencies.rb:229:in `block in require'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-
4.0.8/lib/active_support/dependencies.rb:214:in `load_dependency'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-
4.0.8/lib/active_support/dependencies.rb:229:in `require'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.8
/lib/rails/engine.rb:591:in `block (2 levels) in <class:Engine>'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.8
/lib/rails/engine.rb:590:in `each'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.8
/lib/rails/engine.rb:590:in `block in <class:Engine>'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.8
/lib/rails/initializable.rb:30:in `instance_exec'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.8
/lib/rails/initializable.rb:30:in `run'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.8
/lib/rails/initializable.rb:55:in `block in run_initializers'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:150:in `block i
n tsort_each'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:183:in `block (
2 levels) in each_strongly_connected_component'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:210:in `block (
2 levels) in each_strongly_connected_component_from'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:219:in `each_st
rongly_connected_component_from'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:209:in `block i
n each_strongly_connected_component_from'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.8
/lib/rails/initializable.rb:44:in `each'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.8
/lib/rails/initializable.rb:44:in `tsort_each_child'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:203:in `each_st
rongly_connected_component_from'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:182:in `block i
n each_strongly_connected_component'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_st
rongly_connected_component'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_e
ach'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.8
/lib/rails/initializable.rb:54:in `run_initializers'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.8
/lib/rails/application.rb:215:in `initialize!'
from C:/Sites/sample_app/config/environment.rb:5:in `<top (required)>'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.8
/lib/rails/application.rb:189:in `require'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.8
/lib/rails/application.rb:189:in `require_environment!'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.8
/lib/rails/commands.rb:44:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Here is my gemfile
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.8'
group :development, :test do
gem 'sqlite3', '1.3.8'
gem 'rspec-rails', '2.13.1'
end
group :test do
gem 'selenium-webdriver', '2.35.1'
gem 'capybara', '2.1.0'
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
The first line of my config/enivronments/development.rb file
Rails.application.configure do
I looked up some other answers to this question. And they suggested changing the first line in my development.rb file to SampleApp:Application.configure.do; but that just leads to another error 'unitialized constant SampleApp'. So I I changed it back to default.
EDIT: Fixed it to SampleApp::Application, got this cmd line message after running "rails generate rspec:install"
C:\Sites\sample_app>rails generate rspec:install
DL is deprecated, please use Fiddle
create .rspec
create spec
create spec/spec_helper.rb
Thanks, ok change the first line to
SampleApp::Application.configure do
Looks like you missed the double ::.
Credit to this S.O. answer.