Hi, This is probably the stupidest question that I''m ever going to ask, but how do I create a link to a file? To be more clear, I simply want to create a link to a file that I am storing in the /public directory, say file.pdf. So, I upload the file to /public/ and then I would like to be able to do something like, link_to( image_tag(''image.jpg''), ''file.pdf'', {:target => "_blank"}) But, this doesn''t work: It throws a routing error. I''m sorry, I''m sure this is really easy. Thanks, S -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Just use HTML tags :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You need provide path for file.. if your file.pdf in /public you should do "/public/file.pdf", otherwise it will look for controller .. and throw route error.. This will work On Sep 10, 9:32 pm, Sam Woodard <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > This is probably the stupidest question that I''m ever going to ask, but > how do I create a link to a file? To be more clear, I simply want to > create a link to a file that I am storing in the /public directory, say > file.pdf. So, I upload the file to /public/ and then I would like to be > able to do something like, > > link_to( image_tag(''image.jpg''), ''file.pdf'', {:target => "_blank"}) > > But, this doesn''t work: It throws a routing error. > > I''m sorry, I''m sure this is really easy. > > Thanks, S > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
alexey.Creopolis wrote:> You need provide path for file.. > if your file.pdf in /public you should do "/public/file.pdf", > otherwise it will look for controller .. and throw route error.. > > This will work > > On Sep 10, 9:32 pm, Sam Woodard <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>I''m having similar problems. I''m using link_to which points to a file, however it automatically inserts my :Controller into the url which I don''t want. Can anyone tell me how to stop the controller name from appearing? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---