views:

32

answers:

0

Hi,

My problem is the following:

I have the models events and music_types, connect via hmabtm join table.

If I call now MusicType.all in my event controller I get a complicated query for each music_type I have.

Similar to:

SELECT music_types.id 
FROM music_types 
INNER JOIN join_events_music_types 
   ON music_types.id = join_events_music_types.music_type_id 
WHERE (music_types.id = 4) AND (join_events_music_types.event_id = NULL ) 
LIMIT 1

Could the use of "CanCan" be the reason (automatic loading?)

Thans in advance,

Luis