# Help With id

**URL:** <https://www.ruby-forum.com/t/help-with-id/140661>\
**Category:** Rails\
**Created:** [June 17, 2008, 9:02am UTC](https://www.ruby-forum.com/t/help-with-id/140661 "2008-06-17T09:02:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![link](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/dfb087/32.png) [@link](https://www.ruby-forum.com/u/link)\
**Post date:** [June 17, 2008, 9:02am UTC](https://www.ruby-forum.com/t/help-with-id/140661/1 "2008-06-17T09:02:18Z")

</div>

Hello. I have my rb file:

class CreateDepartamentos \< ActiveRecord::Migration  
def self.up  
create\_table :departamentos, :id=\>null do |t|  
t.string :cvedept, :limit=\>10, :null=\>false  
t.string :desdept, :limit=\>20, :null=\>false

```
  t.timestamps
end

```

end

def self.down  
drop\_table :departamentos  
end  
end

but when i try with a new record i get the next error:

Unown columno “departamento.id” in table “departamentos”.

but i dont have the field “id” in my table.

Help please!.

---

<div class="post-metadata">

**Author:** ![link](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/dfb087/32.png) [@link](https://www.ruby-forum.com/u/link)\
**Post date:** [June 17, 2008, 9:07am UTC](https://www.ruby-forum.com/t/help-with-id/140661/2 "2008-06-17T09:07:01Z")

</div>

On Jun 16, 10:43 pm, Link [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> but when i try with a new record i get the next error:
> 
> Unown columno “departamento.id” in table “departamentos”.
> 
> but i dont have the field “id” in my table.

you need to tell rails what to use as your primary key (via the  
set\_primary\_key function)

Fred
