REST :put question

In my edit view I’ve got an upload image field. When the form is
submitted it renders the update action with the put method. From what
I understand the put method updates a resource. So what if there is no
current image resource to update? Will the put actually look for a
resource to update, and if it cannot find it will it create the
resource?
The reason I ask is because creating an image is optional in my new
view and create method (the user can create is later when they edit
the resource).

From what you’ve said it sounds like the image is not a resource but
an attribute of some resource… I think you should be fine… try it!

I’m actually using attachment_fu with a Photo model. My ‘new’ view has
several models attached to the ‘User’ within a form. Creating a photo
on the create User action is optional. Basically I would like the user
to be able to create a Photo object from the edit view / Update
action. That’s why I’m wondering if the put method will create an
object if none is found. If it doesn’t, then would I have to create a
new method within the ‘edit’ view that will ‘POST’ a new photo?