tesserakt
tesserakt

Reputation: 3331

Getting the image URL without the HTML in Rails

In Rails is there a way to get the URL to the image (going through the assets_host) and just return the URL of the image? I want to use assets_host data in my Javascript, but I just need to insert the URL into the JS, not the whole image_tag.

Thank you in advance!

Upvotes: 18

Views: 17690

Answers (1)

Jordan Running
Jordan Running

Reputation: 106147

image_path will return (you guessed it) the path to the image. It's the same method used in image_tag.

Upvotes: 27

Related Questions