Skip to content

Instantly share code, notes, and snippets.

@Frank004
Created June 11, 2015 15:13
Show Gist options
  • Save Frank004/710071d36cc2818c2ca8 to your computer and use it in GitHub Desktop.
Save Frank004/710071d36cc2818c2ca8 to your computer and use it in GitHub Desktop.
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,:authentication_keys => [:login]
has_one :client_user
has_one :service_user
end
class ClientUser < ActiveRecord::Base
belongs_to :user, :dependent => :destroy
end
class ServiceUser < ActiveRecord::Base
belongs_to :user, :dependent => :destroy
end
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,:authentication_keys => [:login]
belongs_to :loginable, :polymorphic => true
end
class ClientUser < ActiveRecord::Base
has_one :user, :as => :loginable, :dependent => :destroy
end
class ServiceUser < ActiveRecord::Base
has_one :user, :as => :loginable, :dependent => :destroy
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment