download link video

Hello All,

while trying to implement the number of downloads on a particular
video I added a num_downloads column on my video table.

And I tried this below :

<%=link_to "Download",
@video.public_filename, :onClick=>"downloadVideo('#{download_video_url(@video.id)}');alert('csdc');"
%>

downloadVideo is a js function that goes like this below :

function downloadVideo(url) {
        new Ajax.Request(url,{
                method:'get'
        }

)};

But the problem is that I'm having a 500 Http error, so ... my
routes.rb now regarding the videos goes like this :

  map.resources :videos,
        :member => {
                :download => :get,
                :create_comment => :post,
                :paged_comments => :get
        }

I can't figure out why the download action cannot be invoked; if u
have any idea regarding this issue please let me know.

Regards,

Joel

Can you do it without ajax, with normal link? Please note that error
500 could mean the routing is broken, but also there might be problem
in "download" action. You are running in development mode? If so,
could you please provide some error messages / log?