I have two tables User and Order and association between those two table as follow.
in User model
has_many :orders, dependent: :destroy
in Order model
belongs_to :user
I want to select all data from order table but instead of user_id I want to select name of that user from User table.
how can I do in rails? thanks in advance.
Aucun commentaire:
Enregistrer un commentaire