I have a model that I use with active record in a ruby script below. Things like level_type, name, parent.id, and pipcode get assigned to the attributes of the model for entry into the levels table. My question is, does this only work for new records? you see, the name, parent.id, and pipcode get changed often. I dont want it to create a new record everytime these values change. I would like it to update existing records with the new values coming in from pipcode, parent.id etc..
My record creation code:
new_region = Level.new(
:level => level_type,
:name => name,
:parent_id => parent.id,
:make_code => pipcode
)