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
and when trying to scaffold the recipe table from the browser using -
I'm getting the following error
ActiveRecord::StatementInvalid in RecipeController#new
Show session dump
- Did you migrate
- Did you restart WEBrick
- is SQLite3 on your path?
- Did you do gem install sqlite3-ruby
Let me know and we can go from there.
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:
in the console enter
r = Receipe.new
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.
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.
r = Receipe.new
using ruby script/console.
Am getting the same error
from (irb):1:in `new'
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
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
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.