dimanche 24 juin 2018

multi association in rails

I have two model User,Admin every model make login

admin.rb

class Admin < ApplicationRecord
   has_many :user
end 

user.rb

class User < ApplicationRecord
   belongs_to :admin
end 

if already User model can also have many of master

how to add this in models

Aucun commentaire:

Enregistrer un commentaire