Problem with rails scaffolding (windows + netbeans + sqlite3)
I'm experimenting with Ruby on Rails. I'm using NetBeans on Windows 7.
I am trying to follow this tutorial, but instead of using MySQL, I'd like to use SQLite3. Here is my database.yml file:
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# 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:
adapter: sqlite3
database: db/test.sqli开发者_StackOverflowte3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
Whenever I try to follow these steps:
In the Projects window, right-click the rubyweblog project node, and choose Run/Debug Rake Task from the pop-up menu.
Type db in the Filter text box to narrow the task list to just the db tasks, as shown in the following figure.
Select db:create from the Matching Tasks list and click Finish. Rake creates the database for the development configuration as defined in the database.yml file. Note: If you see error messages in the Output window, verify that the user name and password in the development section in the database.yml
I get this error:
(in C:/code/rubyweblog)
rake aborted!
no such file to load -- sqlite3
I've placed the sqlite3.exe in the path referenced in the error and also have the sqlite3-ruby gem installed.
What can I try?
EDIT
My project is set to use JRuby.
UPDATE
Following BJG's answer, I am now getting this error:
(in C:/code/rubyweblog)
db/development.sqlite3 already exists
I am making sure the file is deleted before "raking", but it keeps creating it and giving me this error.
I think you may be missing the sqlite3 gem. See here for instructions on installing sqlite3 and the gem to see if you've covered everything off.
click Tools->Rubygems, select jruby as platform, then check if sqlite3 gem is also installed for jruby. don't forget that you can use several ruby platforms, each one has its own gems path.
If you're using JRuby, you can't use sqlite3-ruby gem. You need the one of the JDBC or similar counterparts.
To use sqlite3-ruby you need any of the versions of Ruby C (known as Matz Ruby Implementation - MRI)
I would suggest install RubyInstaller: http://rubyinstaller.org/
And once installed, install the gem and also download sqlite3 DLL, since that is required for the gem to work, not the executable.
You can search about this here, since this was already answered.
Screw Rails development on Windows. I installed Ubuntu in VMWare Player.
精彩评论