[LRUG] Assset pipeline

Andrew Stewart boss at airbladesoftware.com
Fri Mar 7 02:50:38 PST 2014


Hello LRUG!

I'm upgrading a Rails app from 3.0 to 3.1.  I have an article model which stores the article's text as markdown.  I use HAML's markdown filter to render it like this:

    # app/views/articles/show.html.haml
    %h1= @article.title
    :markdown
      #{@article.contents}

Some of these articles contain images.  Previously all the image references looked like:

    ![Some text here](/images/articles/some-photo.png)

Given the asset pipeline, what paths should I use now?

I see two options:

- either ignore the asset pipeline altogether for these images (by keeping them in public/images/articles/);
- or find a way to evaluate Rails's asset_path() helper within my markdown text.

What's the preferred approach here?

Thanks in advance,

Andy Stewart


More information about the Chat mailing list