I''m trying to create an edit page that will redirect back to the edit page after an update, but what I''m finding is that the update action isn''t getting the :id back, and errors out. Any thoughts or hints? def edit @listing = Listing.find(params[:id]) @listing.photos = Photo.find(:all ) end def update @listing = Listing.find(params[:id]) #ERROR OCCURS HERE ..... end edit.rhtml: <%= form_tag ({:action => ''update''}, {:id => @listing}, {:multipart => true} ) %> <%= render :partial => ''form'' %> <%= submit_tag ''Edit'' %> <%= end_form_tag %> _form.rhtml: <p><label for="listing_status">Status</label><br/> <%= text_field ''listing'', ''status'' %></p> <% @listing.photos.each do |image| %> <%= image_tag url_for(:action => ''image'', :id => image) %> <% end %> <p> <label for="photo_path">Photo Name: </label><br/> <%= file_field("image", "data") %> </p> Ultimately what I''m trying to do is to be able to upload multiple files, but redirecting to the edit page to add one more, while listing the ones that are already loaded. Thanks, Matt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Matt, matt wrote:> I''m trying to create an edit page that will redirect back to the edit page > after an update, <snip> > edit.rhtml: > <%= form_tag ({:action => ''update''}, {:id => @listing}, {:multipart => > true} ) %>Try: <%= form_tag({action => ''update'', :id => @listing}, :multipart => true) %> I think you can exclude the braces (ie., {}), but I''m not sure and don''t have time to test it right now. hth, Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks, That got me into my update method with an :id. On Sat, 2007-01-06 at 20:52 -0600, Bill Walton wrote:> Hi Matt, > > matt wrote: > > > I''m trying to create an edit page that will redirect back to the edit page > > after an update, <snip> > > edit.rhtml: > > <%= form_tag ({:action => ''update''}, {:id => @listing}, {:multipart => > > true} ) %> > > Try: > <%= form_tag({action => ''update'', :id => @listing}, :multipart => true) %> > > I think you can exclude the braces (ie., {}), but I''m not sure and don''t > have time to test it right now. > > hth, > Bill > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---