samedi 13 mai 2017

Getting information from models

I have 3 models in my web app. One is for the posts, the remaining models are used to populate the columns in my post model. The POST model has the following columns:

  • ID
  • Type of animal
  • Species

The other 2 models and their columns are;

TYPE OF ANIMAL:


  • ID
  • Name

SPECIES:

  • ID
  • Name
  • Skin Colour
  • Eye colour

When I create a new object of the POST model, I can choose the names from TYPE OF ANIMAL and SPECIES. Now, in my show view, how can I have access to the other columns of my selected SPECIES model. Lets say I have 10 different species models and I choose number 3, how can I show the information in the skin colour and eye colour columns.

Aucun commentaire:

Enregistrer un commentaire