Scenario:

I'm creating an image file upload service for my web site.

As well as saving the actual file I also need to create a database
record for the file.

I would like to name the file after the record id, but I also need to
save some attributes of the image (width/height/mime_type etc) which I
can't discover until after the file is created.

The Problem:
1) The id is not available until after the record is saved so I can't
create the file until after the record has been created

2) if I try to update the record in the after_create hook it creates an
extra record in the database instead of updating the existing one.

Is this a bug?

Any advice to resolve this problem would be most welcome.

It could be done in the controller of course, but I feel it belongs in
the model.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to