This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in the controller, very simple model for example, having string ip and string description fields: | |
DocType.create(:name => request.remote_ip, :description => 'request') # remote_ip is 127.0.0.1 | |
DocType.create(:name => "127.0.0.1", :description => 'string') | |
# in rails console, only the string assigned object is returned: | |
ruby-1.9.2-p180 :004 > DocType.find_all_by_name('127.0.0.1') | |
DocType Load (0.7ms) SELECT "doc_types".* FROM "doc_types" WHERE "doc_types"."name" = '127.0.0.1' | |
=> [#<DocType id: 7, name: "127.0.0.1", description: "string">] | |
# sqlite shows 2 records as: | |
sqlite> select * from doc_types; | |
6|127.0.0.1|request | |
7|127.0.0.1|string | |
# dump shows: | |
sqlite> .dump doc_types | |
PRAGMA foreign_keys=OFF; | |
BEGIN TRANSACTION; | |
CREATE TABLE "doc_types" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "description" varchar(255)); | |
INSERT INTO "doc_types" VALUES(6,X'3132372E302E302E31','request'); | |
INSERT INTO "doc_types" VALUES(7,'127.0.0.1','string'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment