[Rails] how can action=>render add a ".jnlp" suffix?

Stephen Bannasch stephen.bannasch at gmail.com
Sat Apr 1 05:34:48 GMT 2006


Thanks for the great suggestion Chris. Setting the 
'Content-Disposition' in the headers worked like a charm. I haven't 
tried your route suggestion but thinking about how it should work is 
helping me to better understand routing.

At 11:53 AM -0500 3/31/06, Chris Hall wrote:
>have you tried just setting the Content-Disposition header?
>
>headers["Content-Disposition"] = "attachment; 
>filename='activity#{params[:id]}.jnlp'"
>
>if you still want to go the routes way
>
>link_to "Run", :action => :jnlp", :id => @activity_id, :filename => 
>"activity#{@activity_id}.jnlp"
>
>then in your route
>
>map.connect "page/jnlp/:id/:filename", :controller => "page", 
>:action => "jnlp", :requirements => { :id => /\d+/, :filename => 
>/activity[\d+]\.jnlp/ }
>
>this should result in the URL: 
><http://yourapp/page/jnlp/1/activity1.jnlp>http://yourapp/page/jnlp/1/activity1.jnlp
>
>that route is just off the top of my head, but should be close to correct.
>
>Chris

-- 
- Stephen Bannasch
   Concord Consortium, http://www.concord.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060401/2ceb3053/attachment.html


More information about the Rails mailing list