Dear all, I created a site that asks for personal information such as Name, Age, Etc.. and saves it into a MySQL database table. Now I would like to link a personal picture to these profiles. I have successfully implemented a picture upload with attachment_fu. However, all the picture metadata is saved in the attachment_fu table. What is the best procedure to link the profile table with the attachment_fu table in order to retrieve the filename of the picture ? Also, when users want to change their picture, how do I make sure that the previous picture gets deleted. Right now attachment_fu keeps adding new pictures. I could not find examples on the web for this. This must be a common problem. Thank you, Nick, --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 19 Sep 2007, at 02:47, Nick wrote:> I created a site that asks for personal information such as Name, Age, > Etc.. and saves it into a MySQL database table. Now I would like to > link a personal picture to these profiles. I have successfully > implemented a picture upload with attachment_fu. However, all the > picture metadata is saved in the attachment_fu table. What is the best > procedure to link the profile table with the attachment_fu table in > order to retrieve the filename of the picture ? Also, when users want > to change their picture, how do I make sure that the previous picture > gets deleted. Right now attachment_fu keeps adding new pictures. > > I could not find examples on the web for this. This must be a common > problem.Use a one-on-one relationship (has_one) with the image table. To replace the existing one: destroy the old one and then create a new one. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---