query returning just one value

I am using INNER JOIN and it is supposed to return more than one results but it only returns first element. How do I get all elements in an array? Also, in the same query I am using another INNER JOIN that is supposed to return one value only which is does.

Thanks.

It's hard to help you if you don't show any code.

Maurício Linhares wrote:

It's hard to help you if you don't show any code.

@dest = Destination.find_by_id(params[:id], :joins => "INNER JOIN cities ON cities.id = city_id INNER JOIN destination_images ON destination_images.destination_id = destinations.id AND destination_images.is_primary_photo = 1 INNER JOIN destination_tags ON destination_tags.destination_id = destinations.id", :select => 'destinations.*, cities.name as city_name, destination_images.url as image_url, destination_tags.tag_id as tag_id_list' )

pretty messy though!

This query is never going to return an array, it's going o return a single row (by the params[:id]) with the joined relations.

First you need to explain what you do want returned and your database structure.