Hello All, I need to add a download video functionality to my website. Currently my link looks like that : <%=link_to "Download", @video.public_filename %> But I want to increment a column value (num_downloads) in my db eah time this link is clicked. How can I achieve that. Thanks Joel --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
joel wrote:> Hello All, > > I need to add a download video functionality to my website. Currently > my link looks like that : > > <%=link_to "Download", @video.public_filename %> > > But I want to increment a column value (num_downloads) in my db eah > time this link is clicked. How can I achieve that. > > > Thanks > > > JoelLink to an action, which updates the counter in the database, and use send_file to respond to the request with the video. -- 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 -~----------~----~----~----~------~----~------~--~---
joel wrote:> Hello All, > > I need to add a download video functionality to my website. Currently > my link looks like that : > > <%=link_to "Download", @video.public_filename %> > > But I want to increment a column value (num_downloads) in my db eah > time this link is clicked. How can I achieve that. > > > Thanks > > > Joelmaybe you can use this: <%=link_to "Download", @video.public_filename,:onclick=>''some ajax code to increment column value'' %> -- 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 -~----------~----~----~----~------~----~------~--~---