# Download link video

**URL:** <https://www.ruby-forum.com/t/download-link-video/145004>\
**Category:** Rails\
**Created:** [August 5, 2008, 2:45am UTC](https://www.ruby-forum.com/t/download-link-video/145004 "2008-08-05T02:45:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@joel](https://www.ruby-forum.com/u/joel)\
**Post date:** [August 5, 2008, 2:45am UTC](https://www.ruby-forum.com/t/download-link-video/145004/1 "2008-08-05T02:45:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@joel](https://www.ruby-forum.com/u/joel)\
**Post date:** [August 5, 2008, 8:43am UTC](https://www.ruby-forum.com/t/download-link-video/145004/2 "2008-08-05T08:43:42Z")

</div>

On Aug 5, 2:44 am, joel [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> 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 :

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?
