I know running ruby on rails on Windows has a lot of issues but I cannot do much until I get a new laptop running Linux or OSx.
This is another issue which I am facing randomly. I was able to fix it last time after a lot of trial and error so I have now forgot how to fix it. Here are the things I did so far,
- Created a new rails application
Ran rails generate controller StaticPages home help Everything was ok. I see that new static pages are created but when I run the rails server and hit localhost:3000/static_pages/home I am seeing this below error in the browser response,
Started GET "/static_pages/home" for 127.0.0.1 at 2015-02-28 15:21:13 +1100
LoadError (Could not load 'active_record/connection_adapters/sqlite3_adapter'. M ake sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapt er gem to the Gemfile.): activesupport (4.2.0) lib/active_support/dependencies.rb:274:in `require' activesupport (4.2.0) lib/active_support/dependencies.rb:274:in `block in requ ire' activesupport (4.2.0) lib/active_support/dependencies.rb:240:in `load_dependenactivesupport (4.2.0) lib/active_support/dependencies.rb:274:in
require' activerecord (4.2.0) lib/active_record/connection_adapters/sqlite3_adapter.rb: 6:in' activesupport (4.2.0) lib/active_support/dependencies.rb:274:inrequire' activesupport (4.2.0) lib/active_support/dependencies.rb:274:inblock in requ ire' activesupport (4.2.0) lib/active_support/dependencies.rb:240:inload_dependen cy' activesupport (4.2.0) lib/active_support/dependencies.rb:274:inrequire' activerecord (4.2.0) lib/active_record/connection_adapters/connection_specific ation.rb:175:inspec' activerecord (4.2.0) lib/active_record/connection_handling.rb:50:inestablish _connection' activerecord (4.2.0) lib/active_record/railtie.rb:120:inblock (2 levels) in <class:Railtie>' activesupport (4.2.0) lib/active_support/lazy_load_hooks.rb:38:ininstance_ev al' activesupport (4.2.0) lib/active_support/lazy_load_hooks.rb:38:inexecute_hoo k' activesupport (4.2.0) lib/active_support/lazy_load_hooks.rb:45:inblock in ru n_load_hooks' activesupport (4.2.0) lib/active_support/lazy_load_hooks.rb:44:ineach' activesupport (4.2.0) lib/active_support/lazy_load_hooks.rb:44:inrun_load_ho oks' activerecord (4.2.0) lib/active_record/base.rb:316:in<module:ActiveRecord>' activerecord (4.2.0) lib/active_record/base.rb:26:in' activerecord (4.2.0) lib/active_record/migration.rb:384:inconnection' activerecord (4.2.0) lib/active_record/migration.rb:371:incall' actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:29:inblock in call' activesupport (4.2.0) lib/active_support/callbacks.rb:88:incall' activesupport (4.2.0) lib/active_support/callbacks.rb:88:in_run_callbacks' activesupport (4.2.0) lib/active_support/callbacks.rb:734:in_run_call_callba cks' activesupport (4.2.0) lib/active_support/callbacks.rb:81:inrun_callbacks' actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:27:incall' actionpack (4.2.0) lib/action_dispatch/middleware/reloader.rb:73:incall' actionpack (4.2.0) lib/action_dispatch/middleware/remote_ip.rb:78:incall' actionpack (4.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:inc all' actionpack (4.2.0) lib/action_dispatch/middleware/show_exceptions.rb:30:inca ll' railties (4.2.0) lib/rails/rack/logger.rb:38:incall_app' railties (4.2.0) lib/rails/rack/logger.rb:20:inblock in call' activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:inblock in tag ged' activesupport (4.2.0) lib/active_support/tagged_logging.rb:26:intagged' activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:intagged' railties (4.2.0) lib/rails/rack/logger.rb:20:incall' actionpack (4.2.0) lib/action_dispatch/middleware/request_id.rb:21:incall' rack (1.6.0) lib/rack/methodoverride.rb:22:incall' rack (1.6.0) lib/rack/runtime.rb:18:incall' activesupport (4.2.0) lib/active_support/cache/strategy/local_cache_middleware .rb:28:incall' rack (1.6.0) lib/rack/lock.rb:17:incall' actionpack (4.2.0) lib/action_dispatch/middleware/static.rb:113:incall' rack (1.6.0) lib/rack/sendfile.rb:113:incall' railties (4.2.0) lib/rails/engine.rb:518:incall' railties (4.2.0) lib/rails/application.rb:164:incall' rack (1.6.0) lib/rack/lock.rb:17:incall' rack (1.6.0) lib/rack/content_length.rb:15:in `call'rack (1.6.0) lib/rack/handler/webrick.rb:89:in `service' C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `s ervice' C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `ru n' C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread' Rendered C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4 .2.0/lib/action_dispatch/middleware/templates/rescues/_source.erb (1.0ms) Rendered C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4 .2.0/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (5.0ms) Rendered C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4 .2.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html .erb (1.0ms) Rendered C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4 .2.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb withi n rescues/layout (58.0ms)
There was a similar question here Could not load 'active_record/connection_adapters/sqlite3_adapter' but the solution is not accepted by the person who asked the quesion. I also tried it and it did not work for me.
Gemfile
source 'https://rubygems.org'
gem 'rails', '4.2.0'
gem 'sass-rails', '5.0.1'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
group :development, :test do
gem 'sqlite3', '1.3.9'
gem 'byebug', '3.4.0'
#gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
end
group :test do
gem 'minitest-reporters', '1.0.5'
gem 'mini_backtrace', '0.1.3'
gem 'guard-minitest', '2.3.1'
end
group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
end
Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.0)
actionview (= 4.2.0)
activesupport (= 4.2.0)
rack (~> 1.6.0)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activejob (4.2.0)
activesupport (= 4.2.0)
globalid (>= 0.3.0)
activemodel (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
activerecord (4.2.0)
activemodel (= 4.2.0)
activesupport (= 4.2.0)
arel (~> 6.0)
activesupport (4.2.0)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
ansi (1.5.0)
arel (6.0.0)
builder (3.2.2)
byebug (3.4.0)
columnize (~> 0.8)
debugger-linecache (~> 1.2)
slop (~> 3.6)
celluloid (0.16.0)
timers (~> 4.0.0)
coderay (1.1.0)
coffee-rails (4.1.0)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.3.0)
coffee-script-source
execjs
coffee-script-source (1.9.1)
columnize (0.9.0)
debugger-linecache (1.2.0)
erubis (2.7.0)
execjs (2.3.0)
ffi (1.9.6-x86-mingw32)
formatador (0.2.5)
globalid (0.3.3)
activesupport (>= 4.1.0)
guard (2.12.4)
formatador (>= 0.2.4)
listen (~> 2.7)
lumberjack (~> 1.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-minitest (2.3.1)
guard (~> 2.0)
minitest (>= 3.0)
hike (1.2.3)
hitimes (1.2.2-x86-mingw32)
i18n (0.7.0)
jbuilder (2.2.3)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
jquery-rails (4.0.3)
rails-dom-testing (~> 1.0)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.2)
listen (2.8.5)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
loofah (2.0.1)
nokogiri (>= 1.5.9)
lumberjack (1.0.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
method_source (0.8.2)
mime-types (2.4.3)
mini_backtrace (0.1.3)
minitest (> 1.2.0)
rails (>= 2.3.3)
mini_portile (0.6.2)
minitest (5.5.1)
minitest-reporters (1.0.5)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
multi_json (1.10.1)
nenv (0.2.0)
nokogiri (1.6.6.2-x86-mingw32)
mini_portile (~> 0.6.0)
notiffany (0.0.6)
nenv (~> 0.1)
shellany (~> 0.0)
pg (0.17.1-x86-mingw32)
pry (0.10.1-x86-mingw32)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
win32console (~> 1.3)
rack (1.6.0)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.0)
actionmailer (= 4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
activemodel (= 4.2.0)
activerecord (= 4.2.0)
activesupport (= 4.2.0)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.0)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.5)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.1)
loofah (~> 2.0)
rails_12factor (0.0.2)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.4)
rails_stdout_logging (0.0.3)
railties (4.2.0)
actionpack (= 4.2.0)
activesupport (= 4.2.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rdoc (4.2.0)
json (~> 1.4)
ruby-progressbar (1.7.1)
sass (3.4.13)
sass-rails (5.0.1)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (~> 1.1)
sdoc (0.4.0)
json (~> 1.8)
rdoc (~> 4.0, < 5.0)
shellany (0.0.1)
slop (3.6.0)
spring (1.1.3)
sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.2.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.9-x86-mingw32)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
timers (4.0.1)
hitimes
turbolinks (2.3.0)
coffee-rails
tzinfo (1.2.2)
thread_safe (~> 0.1)
tzinfo-data (1.2015.1)
tzinfo (>= 1.0.0)
uglifier (2.5.3)
execjs (>= 0.3.0)
json (>= 1.8.0)
win32console (1.3.2-x86-mingw32)
PLATFORMS
x86-mingw32
DEPENDENCIES
byebug (= 3.4.0)
coffee-rails (= 4.1.0)
guard-minitest (= 2.3.1)
jbuilder (= 2.2.3)
jquery-rails (= 4.0.3)
mini_backtrace (= 0.1.3)
minitest-reporters (= 1.0.5)
pg (= 0.17.1)
rails (= 4.2.0)
rails_12factor (= 0.0.2)
sass-rails (= 5.0.1)
sdoc (= 0.4.0)
spring (= 1.1.3)
sqlite3 (= 1.3.9)
turbolinks (= 2.3.0)
tzinfo-data
uglifier (= 2.5.3)
database.yml
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: 5
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
database: db/production.sqlite3
Update: rails s command is throwing this exception now,
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x86-mingw32/l
ib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (L
oadError)
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-
x86-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-
x86-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:76:in `require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:72:in `each'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:72:in `block in require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:61:in `each'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:61:in `require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler.rb:133:in `require'
from C:/RailsInstaller/work/sample_app/config/application.rb:7:in `<top
(required)>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands/commands_tasks.rb:78:in `require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Appreciate if someone could help me out here..
database.yml, so just wanted to take a look - Mohammad AbuShadybundle installdidn't complain ? - Mohammad AbuShadypgin the production group, but it has sqlite in the database.yml, if you are running in production environment then this is the problem, replace thepggem with sqlite as the ones in thedevelopment,testingenvironments - Mohammad AbuShady