On Sep 13, 2009, at 8:20 PM, blueHandTalking wrote:

>
> Hi Brett,
>
> Thank you for looking at this. I actually am saving the project
> so I can have the project_id available when I update the photo,
> since I update photo 3 times before the project_detail form is
> submitted.
>
> I do not know why, but the project_id and the user_id are now being
> correctly
> saved.
>
> However, by somehow fixing this (I believe the error previously was
> due to a typo in the photo model -- projecet_id --), I now have
> another problem: the form for the photo will not display. Here is how
> I changed the
> project controller:
>
>   def new
>    @project = Project.new
>    @project.user = current_user
>
>    @project_detail = @project.build_project_detail
>    @project_detail.user = current_user
>    @project_detail.save
>
>    @photo = @project.build_photo
>    @photo.user = current_user
>    @photo.save

This is going to fail unless your photo model has no validations at  
all on it. Almost certainly not what you want.

>    @project.photo_id = @photo.id
>    @project.project_detail_id = @project_detail.id
>    @project.save
>
>    redirect_to :action => "edit"  , :id => @project.id, :photo =>
> @project.photo, :project_detail => @project.project_detail
>
>  end
>
>
> Do I need to be passing some other information in my redirect? Setting
> up local vars? The form was actually coming up fine previously!

What are you redirecting to? The extra params for photo and  
project_detail don't make any sense, unless you're doing something  
weird in your routing.

> I am using
>
>   <form   with="&@project.photo">
>
> in my application.dryml
>
> Does the redirect interfere with Hobo knowing who the current user is?
> Or for security reasons is this info not passed along in redirect?
>

As noted above, it's quite likely that the photo doesn't get saved, as  
it fails validation when set up with build_photo. Alternatively, check  
your permissions for Photo, as something must be wrong...

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

Reply via email to