The column 'id' is not the primary_key ,how to reset the Relationship

I have a table form the second database,it is not through a migration

class Dzhfeed < Dzxdb

set_table_name “pre_home_feed”

set_primary_key :feedid

end
the table:

CREATE TABLE pre_home_feed (
feedid int(10) unsigned NOT NULL auto_increment ,
appid smallint(6) unsigned NOT NULL default ‘0’ ,
icon varchar(30) NOT NULL default ‘’ ',
uid mediumint(8) unsigned NOT NULL default ‘0’ ,
username varchar(15) NOT NULL default ‘’ ',
dateline int(10) unsigned NOT NULL default ‘0’ ,
friend tinyint(1) NOT NULL default ‘0’,
hash_template varchar(32) NOT NULL default ‘’ ,
hash_data varchar(32) NOT NULL default ‘’ ,
title_template text NOT NULL,
title_data text NOT NULL,
body_template text NOT NULL ,
body_data text NOT NULL,
body_general text NOT NULL ,
image_1 varchar(255) NOT NULL default ‘’ ,
image_1_link varchar(255) NOT NULL default ‘’,
image_2 varchar(255) NOT NULL default ‘’ ,
image_2_link varchar(255) NOT NULL default ‘’ ,
image_3 varchar(255) NOT NULL default ‘’ ,
image_3_link varchar(255) NOT NULL default ‘’ ,
image_4 varchar(255) NOT NULL default ‘’ ,
image_4_link varchar(255) NOT NULL default ‘’ ,
target_ids text NOT NULL ,
id mediumint(8) unsigned NOT NULL default ‘0’ ,
idtype varchar(15) NOT NULL default ‘’ ,
hot mediumint(8) unsigned NOT NULL default ‘0’ ,
PRIMARY KEY (feedid),
KEY uid (uid,dateline),
KEY dateline (dateline),
KEY hot (hot),
KEY id (id,idtype)
) ;
but this table has another column named ‘id’ and not a primary_key

so ,when i want to create a new Dzhfeed ,I don’t know how to set the
column named id

my code is

feed = Dzhfeed.new(:appid => 0, :icon => ‘doing’, :uid => 1, :username
=> ‘admin’, :title_template => “xxxxxxxxxx”, :body_template => ‘’,
:dateline => Time.now, :id => 0)
but it not work the error is

Mysql::Error: Column ‘id’ cannot be null: INSERT INTO pre_home_feed
(image_3, uid, id, dateline, title_template, idtype,
image_1, username, body_template, image_1_link, image_3_link,
friend, title_data, appid, body_data, image_2_link, hot,
image_4_link, image_4, hash_template, body_general, icon,
target_ids, hash_data, image_2) VALUES (’’, 1, NULL, 1304675043,
‘xxxxxxxx’, ‘’, ‘’, ‘admin’, ‘’, ‘’, ‘’, 0, ‘’, 0, ‘’, ‘’, 0, ‘’, ‘’,
‘’, ‘’, ‘doing’, ‘’, ‘’, ‘’)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs