I’m using rails 3.
In my database I have several tables that work together using one common column “property_id” to relate them. In my property_images table, there are several images with the same property_id. I use the following code to show all the images in the property/show page.
<% for image in @property.property_images %>
<%= image_tag image.image_url %>
<%end%>
I’d like to be able to display only the first image for the property_id in another area on that page. Does anyone know how I’d write the logic for that in the controller and place it in the property/show page?
you could do something like this.
Since
property_imagesis just an array…