Making an object id editable?


#1

Hello,

I am a newbie trying to integrate a legacy schema into
a simple Rails app.

The table “sites” has primary key called, “site_key.”
The table is in use by other programs written in other
programming languages so I cannot modify the table.

I ran script generate scaffold site and then added:

set_primary_key “site_key”

to the app/models/site.rb file

The key is a 32 char string that needs to be user
generated

So in app/views/sites/_form.rhtml I added:

<%= text_field ‘site’, ‘site_key’ %>

in the Site Key column, copied from the other fields
in the form. Looks like it should work but upon
browser reload I get an error, undefined method
`site_key_before_type_cast’ for #Site:0x4081f828

What does that mean?

Did I make a mistake in my files, or do I need to do
something else to the model to allow for the id to be
editable?

thanks for any help!

Hal


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com