mercredi 26 décembre 2018

Delete a model present in another namespace rails

In Rails when I have made one Model as the foreign key in another model then I can delete that model while speciying its relation like:

class User < ApplicationRecord
  has_many :garments, dependent: :destroy  
end

But if I have one model which is created in another namespace like superadmin them how to write the dependent destroy relation in that case for example I am using :

class User < ApplicationRecord
  has_one superadmin::company , dependent: :destroy
end 

which is incorrect.
The model company is present in namespace superadmin, please tell if their is a correct a way possible. Thanks in advance

Aucun commentaire:

Enregistrer un commentaire