How does the attribute types in a Rails model get mapped to the table columns in case the table already exists. e.g., for this table
CREATE TABLE feedback (
idx NUMBER NOT NULL,
locale CHAR(20) NOT NULL,
category VARCHAR(30),
store VARCHAR(30),
node VARCHAR(20),
sort VARCHAR(30),
page VARCHAR(30),
vote CHAR(1),
flag CHAR(1),
date_val CHAR(10),
time_val CHAR(8),
keyword VARCHAR(256),
url VARCHAR(4000),
rsp VARCHAR(4000),
PRIMARY KEY(idx),
);
and this model
class Feedback < ActiveRecord::Base
self.table_name = 'feedback'
set_primary_key :idx
attr_accessible :idx, :locale, :category, :store, :node, :sort, :page
attr_accessible :vote, :flag, :date_val, :time_val, :keyword, :url, :rsp
end
What type will the values with CHAR(1) be mapped to, is there a way to specify that in the model?
Aucun commentaire:
Enregistrer un commentaire