I need to display multiple images for a a car from a separate linked table, i have the both models sorted with the belongs_to and has_many but on the main car page i need to show images from the linked table that have the same id.
here is the current code:-
<p id="notice"><%= notice %></p>
<h2>
<em><%= @car.make.make_name %> <%= @car.model %> <%= @car.body_typw %> <%= @car.engine_size %> <%= @car.trim %></em>
</h2>
<p>
<%= image_tag @car.image(:large) %>
</p>
<% @carimages.each do |carimage| %>
<%= image_tag carimage.image(:thumb), :class => "imgsmall" %>
<% end %>
<p>
<b>Transmission:</b>
<%= @car.transmission %>
</p>
<p>
<b>Fuel type:</b>
<%= @car.fuel_type %>
</p>
<p>
<b>Millage:</b>
<%= @car.millage %>
</p>
<p>
<b>Price:</b>
<%= number_to_currency(@car.price) %>
</p>
<p>
<%= raw @car.content %>
</p>
<p style="font-size:16px;"><b>Call us now on <span style="color:red;">01446 746 785</span> to find out more about the <%= @car.model %> <%= @car.body_typw %> <%= @car.engine_size %> <%= @car.trim %></b></p>
so basically the url is – http://localhost:3000/cars/1 and i want the car images with the linked id of car_id of 1 to be shown.
Robbie
This does the trick: