Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Open Source > Ruby
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Ruby section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 15th, 2007, 11:48 AM
Registered User
Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default In Rails how to link to text file

I'm trying to figure a way to create a link to a word file or
a pdf. When I click on the link it would be fine if the file
opened up in it's own window outside of the browser. I haven't
found any examples of this.

Old October 16th, 2007, 09:22 AM
Friend of Wrox
Join Date: Dec 2003
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts

Put my_document.pdf into the public/resource directory.

In your template do:
<%= link_to 'My Document', '/resource/my_document.pdf' -%>
Charlie Harvey's website - linux, perl, java, anarchism and punk rock: http://charlieharvey.org.uk

Similar Threads
Thread Thread Starter Forum Replies Last Post
Link a text file to Access using VBA wscheiman Access VBA 1 June 30th, 2013 07:02 PM
Beginning Ruby on Rails - chapter 11: Ajax & Rails rornet BOOK: Beginning Ruby on Rails 1 June 22nd, 2007 04:10 PM
make link in text area saban ASP.NET 1.0 and 1.1 Basics 7 November 15th, 2006 11:18 AM
insert text into a text box by selecting an link gavmc Other Programming Languages 0 February 15th, 2006 09:46 AM
Autofill text from an Email Link zanna5910 Access 1 September 28th, 2005 07:13 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.