i am offering my site visitors a download of zip file. when someone downloads it, i want to increment a counter and update db. how do i do that? -- Posted via http://www.ruby-forum.com/.
Rails List wrote:> i am offering my site visitors a download of zip file. when someone > downloads it, i want to increment a counter and update db. how do i do > that?I should think it would be obvious -- just put an increment routine in the action that generates the zip file. Or if it''s a static file, use your Web server''s access logs. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
I am interested in showing the no. of times this file has been downloaded by updating a text field/area. So using webserver log files may not help. I am looking for the possibility of using link_to. When clicked, it should download the file and update the db in its onclick event. not sure how to do that/ -- Posted via http://www.ruby-forum.com/.
Rails List wrote: [...]> I am looking for the possibility of using link_to. When clicked, it > should download the file and update the db in its onclick event. > > not sure how to do that/Apparently you didn''t fully read my first message. Go back and do that, since I explain it there. (Hint: onclick doesn''t come into it.) Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
On 18 Aug 2009, at 06:24, Marnen Laibow-Koser wrote:>> I am looking for the possibility of using link_to. When clicked, it >> should download the file and update the db in its onclick event. >> >> not sure how to do that/ > > Apparently you didn''t fully read my first message. Go back and do > that, > since I explain it there. (Hint: onclick doesn''t come into it.)In case your penny doesn''t drop: User clicks link -> Serverside method "download" is triggered -> "download" methods does downloads = downloads + 1, save to db, and then return file to download 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 -~----------~----~----~----~------~----~------~--~---