views:

539

answers:

1

On a rails project I am using the image_tag to generate my image html elements.

<%= image_tag("test.jpg", :alt => "test image") %>

is generating

<img src="test.jpg" alt="test image">

This is happening throughout my entire rails project.

Is there a setting somewhere that someone else set that is causing this? How can I get rails to always close the image tag?

+3  A: 

image_tag is implemented in terms of ActionView::Helpers::TagHelper.tag which takes an optional third parameter that says whether to close the tag or not (for XHTML compliance). By default it's off, but something is setting yours to true. Not sure where. You should be able to say

 tag("img", { :src => "test.jpg" }, false)

to force it.

Phil Windley