good evening (and morning, also!) everyone. this is my first attempt
at using sqlite3 for a rails app, and so far, not so good
when I try to save a very basic record from the controller, it gives
me back an ActiveRecord::StatementInvalid error.
“that doesn’t sound very nice”
so I switched the app to mysql and sure enough, it went through
without a hitch. unsatisfied, I switched back to sqlite3 and fired up
the console
mike@lua:~/Rails/hotspots$ ./script/console
Loading development environment.
spot = Hotspot.new :title => “testing”, :address => “222 water
st”
=> #<Hotspot:0xb732af48 @attributes={“title”=>“testing”,
“notes”=>“NULL”, “user_id”=>0, “lat”=>“NULL”, “address”=>“222 water
st”, “long”=>“NULL”}, @new_record=true>spot.save
=> true
“???”
and here’s the source, right from the controller’s mouth:
def create
if session[:user]
spot = Hotspot.new :title => “testing”, :address => “222 water st”
spot.save
end
end
and here’s what that gives me:
Processing ApiController#create (for 127.0.0.1 at 2007-05-09 23:30:52)
[POST]
Session ID: b859a7e645f2c60ddd4747368a677b04
Parameters: {“title”=>“asdf”, “action”=>“create”, “notes”=>"",
“controller”=>“api”, “address”=>“asdf”, “lat”=>“47.54501765940571”,
“long”=>"-52.7204704284668"}
User Load (0.000560) SELECT * FROM users WHERE (login = ‘mikew’
and password = ‘test’) LIMIT 1
SQL (0.000000) SQLite3::SQLException: SQL logic error or missing
database: INSERT INTO hotspots (“title”, “notes”, “user_id”,
“address”, “lat”, “long”) VALUES(‘testing’, ‘NULL’, 0, ‘222 water st’,
‘NULL’, ‘NULL’)
ActiveRecord::StatementInvalid (SQLite3::SQLException: SQL logic error
or missing database: INSERT INTO hotspots (“title”, “notes”,
“user_id”, “address”, “lat”, “long”) VALUES(‘testing’, ‘NULL’, 0, ‘222
water st’, ‘NULL’, ‘NULL’))
now I can’t make any sense of what’s going on