Using :joins gives me the wrong id

Hi,

I have a bit of code like so:

@city = City.find(params[:id])
@event_pages, @events = paginate :events, :per_page => 10,
    :joins => ["inner join locations on events.location_id =
locations.id"],
    :conditions => ["locations.city_id = ?", @city.id]

Strangely, when I want to list @events, everything seems to be working
fine, but the event objects are getting the id of location instead of
the event. The rest of the event columns/attributes are getting the
right values. Only id happens to be from the respective location! I'm
confused. Looks like a rails bug, any hints?

TIA,
Vamsee.

add :select => 'events.*'

ActiveRecord does a SELECT * by default.

Rick Olson wrote:

add :select => 'events.*'

ActiveRecord does a SELECT * by default.

D'oh. I should have tried that. Thanks, it works.

Vamsee.