ruby on rails question

I have an hash table

p[:ticket][:id]
p[:ticket][:name]
p[:ticket][:pid]

when I call this code

t = Ticket.first(p[:ticket][:id])
t.update_attributes!(p[:ticket])

only ‘id’ and ‘name’ get updated, ‘pid’ gets blanked out

Tickets table has those 3 columns and the code below works fine so the values are stored in the initial p hash table

t = Ticket.first(p[:ticket][:id])
t.update_attributes!(p[:ticket])
t.update_attribute(:pid, p[:ticket][:pid])

Where did I fuck up?

is this coming from an .erb template?

you should probably rename

p[:ticket][:pid]  to p[:ticket][:priority_id]

since it looks like that is the real column name

your erb template prob looks like this:

<%= f.select @ticket, :pid %>

when it should look like

<%= f.select @ticket, :priority_id %>

is this coming from an .erb template?

you should probably rename

p[:ticket][:pid]  to p[:ticket][:priority_id]

since it looks like that is the real column name

your erb template prob looks like this:

<%= f.select @ticket, :pid %>

when it should look like

<%= f.select @ticket, :priority_id %>

sorry i shortened the names for OT. I think it was a plugin i used. after i added some validate_presence_of fields, they started working. Also i had to make sure all my models were set up correctly for the one to many relationships

i was using has_one when i should have been using belongs_to

thanks!!!