So for completion, I discovered the source of my error. I was creating a 'new' page from the projects controller, where I had not saved the @photo instance which was also created. The @photo belongs_to the project. I thought I could use find to locate the instance, but this is now clearly not the way things work. Need to save before something can be found.
I have gone back to my original concept of creating instances in project controller, saving them and then redirect_to 'edit'. In edit I create new instance @project and @photo. Now my method 'upload_main' works correctly if i use: @photo = Photo.find_by_project_id(params[:id]) Thanks for your help Matt. I have yet another question, which will be a new post regarding @photo.save Jet On Sep 15, 5:34 pm, Matt Jones <[email protected]> wrote: > On Sep 15, 2009, at 7:48 PM, blueHandTalking wrote: > > > > > I would like to use a flash notice to check the params hash. > > > Is this the correct way to construct the assignment and call in the > > controller: > > > flash[:notice]= @photo.params.inspect > > Either use @photo.inspect or @photo.attributes.inspect - both should > work. > > --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 -~----------~----~----~----~------~----~------~--~---
