Ruby on Rails & SQLite3


I’m just a beginner in Ruby.
Have just installed Rails and Gems.
I am using SQLite3 as the db.

When going thro the “CookBook” tutorial.
after creating the recipes table in the sqlite3 database.
and changing the config file - database.yml as

adapter: sqlite3
dbfile: db/test.db

adapter: sqlite3
dbfile: db/test.db

adapter: sqlite3
dbfile: db/test.db

and when trying to scaffold the recipe table from the browser using -

I’m getting the following error

ActiveRecord::StatementInvalid in RecipeController#new

RAILS_ROOT: ./script/…/config/…

Show session dump

flash: !map:ActionController::Flash::FlashHash {}

Headers: {“cookie”=>[], “Cache-Control”=>“no-cache”}

Could anybody tell me, where i am going wrong??

Thanks in advance.


  1. Did you migrate
  2. Did you restart WEBrick
  3. is SQLite3 on your path?
  4. Did you do gem install sqlite3-ruby

Let me know and we can go from there.

Hi Brian,

  1. Did you migrate
    No , i did not migrate

  2. Did you restart WEBrick
    yes, Had restarted WEBrick after changing the config files.

  3. is SQLite3 on your path?
    Yes, SQLite3 is set in my path.

  4. Did you do gem install sqlite3-ruby
    Yes, i have used gem install sqlite3-ruby-1.1.0
    and have installed the latest version of mswin32.gem

What would the problem be.??


Did you try creating a new recipe via the console?

cd to the root of your rails application and enter:

ruby script/console

in the console enter

r =

And check what happens.

I haven’t developed anything on windows for a while but iirc you have to
specify the full path to your db, i.e.

dbfile: c:/yourapp/db/test.db

I cannot remember if it’s forward of back slashes, you should try both

You may also want to look at this -

easiest option for windows by the look of things.

The full path is not required in windows.

dbfile: db/test.db

is fine.

Hi Malmeida,


r =
using ruby script/console.

Am getting the same error

ActiveRecord::StatementInvalid: ActiveRecord::StatementInvalid
d/connection_adapters/sqlite_adapter.rb:259:in table_structure' from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_suppo rt/core_ext/object/misc.rb:23:inreturning’
d/connection_adapters/sqlite_adapter.rb:258:in table_structure' from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_recor d/connection_adapters/sqlite_adapter.rb:196:incolumns’
d/base.rb:696:in columns' from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_recor d/base.rb:1969:inattributes_from_column_definition’
d/base.rb:1351:in initialize_without_callbacks' from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_recor d/callbacks.rb:236:ininitialize’
from (irb):1:in `new’
from (irb):1
Active Record::Statement Invalid

Been stuck with this for the past 1 week.
Would be really happy if anybody could help me solve this problem :slight_smile:


What does your model look like?

You did not migrate, so did you even create a table Recipe in the
What does your table structure look like? You can fire up sqlite and
dump the table structure

sqlite db/dev.db


That should print out what your tables look like. It could be table
name and your model names are not matching (Rails magically assumes
pluralized table names, but the model names are singular, etc.), or you
might not even have a Recipe table in your db.

Another question. Are you spelling Recipe or Receipe?! In the above
posts, I see Receipe but should be Recipe.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs