I am doing an 'Ajaxy' upload of 3 image files from 3 different forms
on the same page.
This is now working with Paperclip and responds_to_parent with an
<iframe> to upload
the images from the current page, and also display them in the current
page without it
being refreshed.
What I now need to do is check to be sure the record has not already
been created by one
of the other 2 forms.
A photo instance is create in another controller when the page is
loaded, but it is not
saved. It was my understanding that no id is created until the
instance is saved.
The following is what I have used to see if id has been saved, but it
does not work:
@photo = Photo.find(params[:id])
if @photo.id != nil
@photo.update_attributes(params[:photo])
else
@photo = Photo.new(params[:photo]
end
Also tried
if @photo.id?
Curious as to why this does not work.
Cheers,
Jet
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---