This project is archived and is in readonly mode.
Sqlite3, AR and Quoting issue
-
qoobaa
Migration:
class CreateMyModels < ActiveRecord::Migration def self.up create_table :my_models do |t| t.string :first_timestamp t.date :second_timestamp t.datetime :third_timestamp t.timestamps end end endModel:
class MyModel < ActiveRecord::Base endCreating:
MyModel.create(:first_timestamp => "2009-05-06 20:38:00", :second_timestamp => "2009-05-06 20:38:00", :third_timestamp => "2009-05-06 20:38:00")Let's see database:
Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> .d BEGIN TRANSACTION; CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL); INSERT INTO "schema_migrations" VALUES('20090506183730'); CREATE TABLE "my_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_timestamp" varchar(255), "second_timestamp" date, "third_timestamp" datetime, "created_at" datetime, "updated_at" datetime); INSERT INTO "my_models" VALUES(1,'2009-05-06 20:38:00','2009-05-06','2009-05-06 20:38:00','2009-05-06 18:38:51','2009-05-06 18:38:51'); DELETE FROM sqlite_sequence; INSERT INTO "sqlite_sequence" VALUES('my_models',1); CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version"); COMMIT; sqlite> select * from my_models; 1|2009-05-06 20:38:00|2009-05-06|2009-05-06 20:38:00|2009-05-06 18:38:51|2009-05-06 18:38:51About your application's environment Ruby version 1.9.1 (x86_64-linux) RubyGems version 1.3.3 Rack version 1.0 bundled Rails version 2.3.2 Active Record version 2.3.2 Action Pack version 2.3.2 Active Resource version 2.3.2 Action Mailer version 2.3.2 Active Support version 2.3.2 Environment development Database adapter sqlite3Everything works perfectly using sqlite3-ruby (1.2.4).
-
Prem Sichanugrist (sikachu)
- State changed from new to invalid