Topic: One request for getting attribute name to an ID
I have got my consultant model and in thius model I have an ID for a status the guy has. These status are in another table where they only have a id and a name.
Everytime I fetch a consultant it should include the name or that ID. I have set up belongs_to and has_one in the models. but everytime rails makes 2 requests like that:
Consultant Load (0.3ms) SELECT `consultants`.* FROM `consultants` WHERE `consultants`.`person_id` = 4446 LIMIT 1
ConsultantStatus Load (0.2ms) SELECT `consultant_statuses`.* FROM `consultant_statuses` WHERE `consultant_statuses`.`id` = 5 LIMIT 1
Is there a possibility to make rails fetch that stuff in one request?