Hi, making the switchover from the file_upload plugin to the pretty awesome Attachment_Fu plugin to handle all my image uploads, so far going good, but stuck on two things? Any ideas how i can basically update an image & delete an image ? can''t seem to find any good examples anywhere, appreciate it, John. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
it should support User.update_attributes(params[:user]) where user.rb has the has_attachment in the model and inside params[:user] is an "uploaded_data" file field. Adam On Dec 12, 2007 9:44 AM, John Griffiths <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi, making the switchover from the file_upload plugin to the pretty > awesome Attachment_Fu plugin to handle all my image uploads, > > so far going good, but stuck on two things? > > Any ideas how i can basically update an image & delete an image ? > > can''t seem to find any good examples anywhere, > > appreciate it, > > > > John. > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 for that, here''s my working [delete] button on the show page <%= button_to "Delete Photo", :action => "destroy", :id => @image %> and my destroy method... def destroy Image.find(params[:id]).destroy redirect_to :action => ''list'' end and here''s the [edit] page... <% form_for(:image, :url => {:id => @image, :action => "update" }, :html => { :multipart => true }) do |f| -%> <p>Replace Photo:<br/> <%= image_tag @image.public_filename(:thumb) %> <br/> with <%= f.file_field :uploaded_data %> </p> <p> <%= f.submit ''Save Changes'' %> or <%= button_to_function "Go Back", "window.location=''/image/show/#{@image.id}''" %> </p> <% end -%> and the method... def edit @image = Image.find(params[:id]) end def update @image = Image.find(params[:id]) if @image.update_attributes(params[:image]) flash[:notice] = ''Photo was successfully updated.'' redirect_to :action => ''show'', :id => @image else flash[:notice] = ''Something awful just happend!'' render :action => ''edit'' end end all work, just thought i should post them, so glad i got that out of the way, thanks AD -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---