views:

19

answers:

1

Hi,

I'm trying to think of a way a user could make changes to a record that includes changing the picture (added via paperclip), preview the changes and then accept or cancel. Is there any way to do this without using temp tables as the image cannot be rendered without a path linked to an id?

A: 

I've done this before by adding an extra boolean column draft to model's table.

After you "create" the record the value of draft should be true (Actually the default value of draft should be true) and the user should be redirected to the preview action, when the user accepts the preview, the value of draft should change to false.

Also you should define a scope in your model to find all the draft records, something like:

scope :draft, where(["draft = ?", true])

Hope it gives you an idea.

jpemberthy
thanks for the suggestion but as I need to be able edit existing records, preview and go back I think I'll need a temporary table to upload pictures against.
nktokyo