I want to link to a file outside rails application. It is a text file
stored in rails server disk. When user click this link, the file will be
open.
How can I do this?
thanks.
I want to link to a file outside rails application. It is a text file
stored in rails server disk. When user click this link, the file will be
open.
How can I do this?
thanks.
That’s a good question, and I’ll let someone else handle it as I leave
work tonight.
However, I might recommend probably starting up one thread on the
mailing list and asking your questions in there. Will be easier to
keep track of them if they are all in one place. Thanks!
Rob Zolkos wrote:
Hi,
Try this :
<%= link_to “file”, “http://www.mysite.com/the_file.doc” %>
Regards,
Rob
My problem is that the file is not in Rails application. There is on
“http://” start. I just want to point to a local file in the server hard
disk. For example: <%= link_to “file”, “/tmp/hello.txt” %>
hi Zhao,
u can use send_file to relate the file in u’r file system but not in
public dir of u’r rails proj like,
send_file(RAILS_ROOT+“/images_uploaded/”+params[:filename] ,
:disposition => ‘inline’)
-manmay
On Thu, Jan 22, 2009 at 10:58 AM, Zhao Yi
[email protected] wrote:
My problem is that the file is not in Rails application. There is on
“http://” start. I just want to point to a local file in the server hard
disk. For example: <%= link_to “file”, “/tmp/hello.txt” %>Posted via http://www.ruby-forum.com/.
–
M@nmay
Manmay wrote:
hi Zhao,
u can use send_file to relate the file in u’r file system but not in
public dir of u’r rails proj like,send_file(RAILS_ROOT+"/images_uploaded/"+params[:filename] ,
:disposition => ‘inline’)
I have tried but got undefined method `send_file’ for
#ActionView::Base:0x41222cc0 error, this is my code in *.html.erb:
…
MaD wrote:
try to put send_file in an action of your controller.
http://www.railsbrain.com/api/rails-2.2.2/doc/index.html?a=M000167&name=send_file
I use link_to to an action and in this action I use send_file method. In
this action, how can I get the value of the link_to tag?
what kind of value do you need?
you can set :params => {:key => :value} and read them in your
controller.
try to put send_file in an action of your controller.
http://www.railsbrain.com/api/rails-2.2.2/doc/index.html?a=M000167&name=send_file
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs