I'm following the instructions in rails tutorial and got stuck when trying to use the scaffold command.
When running:
rails generate scaffold User name:string email:string
I get the error:
C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection': Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (can't activate sqlite3 (~> 1.3.4), already activated sqlite3-1.3.3-x86-mingw32. Make sure all dependencies are added to Gemfile.) (RuntimeError)
Running:
gem install activerecord-sqlite3-adapter
I got the error:
ERROR: Could not find a valid gem 'activerecord-sqlite3-adapter' (>= 0) in any repository
ERROR: Possible alternatives: activerecord-jdbcsqlite3-adapter, activerecord-sqlserver-adapter, activerecord-nulldb-adapter, activerecord-spatialite-adapter, activerecord-simpledb-adapter
My Gemfile looks like this:
source 'http://rubygems.org'
gem 'rails', '3.1.0'
gem 'sqlite3', '1.3.3'
...
I'm running on Windows 7 x64 OS.
Any ideas?
suggested install command:
actual install command:
Reference: http://kenai.com/jira/browse/ACTIVERECORD_JDBC-19
Instead of
run
i had this error too, buy my problem was slightly different. the issue is that sqlite3-ruby is deprecated, to be replaced by sqlite3. in michael hartl's webcast, he still used the old sqlite3-ruby.
I edited my gemfile to use sqlite 1.3.4 instead of sqlite3-ruby 1.3.1. re-ran bundle install, and voila, problem solved!
Ok I found the problem. I noticed that my Rails installation has both SQLite 1.3.3 and 1.3.4 I changed my Gemfile from:
to:
That solved the problem. Thanks @holger-just for pointing me to the relevant line in the error message in their answer.
Also on Rails Tutorial, ran:
Got the following error:
Ran:
$ gem install activerecord-sqlite3-adapter
Got:
Changed Gemfile according to one of the answers above:
Got another error so had to install:
Tried running $ rake db:migrate again, but got another error, this time resembling the answer above:
So changed Gemfile to:
And got another error message to make sure 'gem install sqlite3 -v '1.3.5' succeeds (wtf?! alright again). Installed it successfully, ran bundle install.
Tried running:
Nothing happened, so tried:
Per another suggestion above. And it finally worked. The tutorial warned of a laborious setup process, but I felt like I had to mix and match from at least 5 other people. Hope this helps the next person.
The important part of your error message is this snippet:
To fix that, you should always run your commands through
bundle exec
like soThat way, you give bundler to take full control over your
$LOAD_PATH
which will probably resolve these issues.