how to set primary key in rails 2.0.2

in your user model write
set_primary_key "user_id"

Bala kishore Pulicherla wrote:

in your user model write
set_primary_key "user_id"

On Jul 19, 9:22�am, dare ruby <>

Dear bala,

Thanks for your suggestion. its working fine now.

Could you please provide details about auto incrementation for above
mentioned primary key.

Thanks in advance

Jose Martin

u can put the id as itself as an auto increment and while ur creating the new user make the id to user_id and update.

for ex.
user =[:user])
user_id =

respond_to |format| do
ur - stuff

mean while i’ll find any :auto_increment option is there :frowning:

t.column :user_id, :primary_key, :null => false

hope this will work for u :slight_smile:

ur welcome. :slight_smile: