Search code examples
rubyerbassetsdashing

Display static image on dashboard.erb using Shopify/Dashing from assets


I have a working dashboard using dashing (http://dashing.io/) and I'd like to place a static image that I have stored in my assets/images folder as part of a banner across the top of the dashboard.

I'm trying to get this to work at the top of my dashboard.erb file: <img src="/assets/images/test_image.png">

This won't display an image at the top of dashboard, but when it's located elsewhere then <img src="exampleurl.com/images/test_image"> will display the image.

I think I'm missing something major here and I imagine it's to do with Sprockets from the reading I've done, but I don't quite understand the implementation.


Solution

  • My goal was to have a static image placed at the top of my dashing dashboard that I referenced from the assets folder in the webroot. After trying to figure out how to reference the image locally in the dashboard.erb file, I found that if your image placed in /assets/images/test_image.png then the resulting html looks like:

    <img src="assets/test_image.png">

    At this point the image should show up on your dashboard.

    I hope this helps someone else!