i wanted to know about the data type references and some examples of how/why it would be used on a website. If their is a difference when using Ruby-on-Rails, i tagged it just in case. I am new at programming and it would help tremendously to explain everything in layman’s terms so i can slowly build my way up to being a computer wiz.
Appreciate the trouble in helping me, thanks.
I’m taking a guess that you’re referring to
t.references :associated_modelin a migration?Suppose two models, Post and Author.
Your migration contains:
This will create the
author_idcolumn on thepoststable with theintegerdatatype.In migrations,
t.belongs_tois an alias fort.referencesand matches the naming used to set up the associations in your models.