O.K.,
I added a couple of hidden fields to my form so I would actually have
a NULL value \
for 'id'
Here is the output from the Apache access log:
Processing PhotosController#upload_main (for 66.165.26.17 at
2009-09-15 22:43:43) [POST]
Parameters: {"photo"=>{"project_id"=>"", "mainimg"=>#<File:/tmp/
RackMultipart.26337.1>, "id"=>"", "user_id"=>"14"},
"page_path"=>"projects/new",
"authenticity_token"=>"3OFNLLHqAsAGm9il9CsPjRNhJzDE+L2ygiAQyyqzB7E=",
"after_submit"=>"stay-here"}
'id' is definitely NULL now.
...and this:
if @photo.id != nil
Is either evaluating to true, or the following:
@photo = Photo.find(params[:id])
is causing an error?
I definitely have not saved or assigned the id elsewhere, as Apache
log indicates.
jet
On Sep 15, 3:02 pm, Matt Jones <[email protected]> wrote:
> On Sep 15, 2009, at 5:45 PM, blueHandTalking wrote:
>
> > 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
> > �[email protected]_attributes(params[:photo])
> > else
> > @photo = Photo.new(params[:photo]
> > end
>
> If you found it with Photo.find(params[:id]), it had better have an
> id, in particular an id == params[:id].
>
> Objects that are created but not yet saved in another controller won't
> be visible to anybody...
>
> --Matt Jones
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---