# Paths to images in fixtures with Rails

**URL:** <https://discuss.emberjs.com/t/paths-to-images-in-fixtures-with-rails/1224>\
**Category:** Ember Data\
**Created:** [May 11, 2013, 8:22pm UTC](https://discuss.emberjs.com/t/paths-to-images-in-fixtures-with-rails/1224 "2013-05-11T20:22:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![paddleman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/paddleman/32/16419_2.png) [@paddleman](https://discuss.emberjs.com/u/paddleman)\
**Post date:** [May 11, 2013, 8:22pm UTC](https://discuss.emberjs.com/t/paths-to-images-in-fixtures-with-rails/1224/1 "2013-05-11T20:22:56Z")

</div>

I am learning ember; using ember with a rails backend and the ember-rails gem.

I am using the FixtureAdapter. In my FIXTURES, I have a imageUrl attribute.

How should the `imageUrl: "/path/to/images/image.png"` be referenced if I place those images in the app/assets/images/ directory?

All help is appreciated.

Thanks DJ

---

<div class="post-metadata">

**Author:** ![paddleman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/paddleman/32/16419_2.png) [@paddleman](https://discuss.emberjs.com/u/paddleman)\
**Post date:** [May 11, 2013, 11:19pm UTC](https://discuss.emberjs.com/t/paths-to-images-in-fixtures-with-rails/1224/2 "2013-05-11T23:19:21Z")

</div>

I figured this one out.

With the asset pipeline, one removes the /images/ directory.

Placing the image files in app/assets/image/ then, in FIXTURES , you reference imageUrl: ‘assets/image.png’

---

<div class="post-metadata">

**Author:** ![zeltice](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/zeltice/32/4646_2.png) [@zeltice](https://discuss.emberjs.com/u/zeltice)\
**Post date:** [August 15, 2013, 8:55am UTC](https://discuss.emberjs.com/t/paths-to-images-in-fixtures-with-rails/1224/3 "2013-08-15T08:55:02Z")

</div>

It’s all well and good in development, but what about production, when your ‘assets/image.png’ gets transformed into something like ‘assets/image-lksadf8sdfkjsdf98sd7f9s8df.png’ how would you guess what is the correct path to the image through hard coding like this?

---

<div class="post-metadata">

**Author:** ![lookingsideways](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/lookingsideways/32/13652_2.png) [@lookingsideways](https://discuss.emberjs.com/u/lookingsideways)\
**Post date:** [August 15, 2013, 9:24am UTC](https://discuss.emberjs.com/t/paths-to-images-in-fixtures-with-rails/1224/4 "2013-08-15T09:24:20Z")

</div>

I’ve not tried this in an Ember app but the Rails asset pipeline can run multiple pre-processors, so you could name your JS file `store.js.erb`, and then reference your image like so:

`imageUrl: "<%= asset_path('image.png') %>"`

See the ‘Coding Links to Assets’ and ‘Preprocessing’ sections of [The Asset Pipeline — Ruby on Rails Guides](http://guides.rubyonrails.org/asset_pipeline.html) for more info.
