John
John

Reputation: 4706

Argument of send_file

I put this in my Rails controller

send_file('/public/images/rails.png')

but it gives error

Cannot read file /public/images/rails.png

even though the file is there. How can I fix it?

Upvotes: 1

Views: 885

Answers (1)

Nobita
Nobita

Reputation: 23713

Try doing this:

send_file("#{Rails.root}/public/images/rails.png")

Upvotes: 3

Related Questions