# REST :put question

**URL:** <https://www.ruby-forum.com/t/rest-put-question/108366>\
**Category:** Rails\
**Created:** [July 2, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/rest-put-question/108366 "2007-07-02T20:35:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jko170](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jko170](https://www.ruby-forum.com/u/jko170)\
**Post date:** [July 2, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/rest-put-question/108366/1 "2007-07-02T20:35:56Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![jko170](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jko170](https://www.ruby-forum.com/u/jko170)\
**Post date:** [July 2, 2007, 9:07pm UTC](https://www.ruby-forum.com/t/rest-put-question/108366/2 "2007-07-02T21:07:02Z")

</div>

> 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!

---

<div class="post-metadata">

**Author:** ![jko170](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jko170](https://www.ruby-forum.com/u/jko170)\
**Post date:** [July 2, 2007, 9:21pm UTC](https://www.ruby-forum.com/t/rest-put-question/108366/3 "2007-07-02T21:21:04Z")

</div>

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?
