Devise with Omniauth for multiple models without STI

前端 未结 4 2001
情深已故
情深已故 2021-01-17 21:06

Is there any way to configure Devise Omniauth for multiple models without STI?

We have the models Students and Professors and we didn\'t want to use STI but now we r

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-17 21:30

    I think rather than writing :omniauthable to individual Student & Professor model. You should generate third model like Omniuser and add :omniauthable settings to it.

    class Student < ActiveRecord::Base
      has_one :omniuser
    end
    
    class Professor < ActiveRecord::Base
      has_one :omniuser
    end
    

提交回复
热议问题