mixing in some sorcery auth

This commit is contained in:
2015-10-07 22:03:31 -05:00
parent 63d4063392
commit 5a9c4a341a
23 changed files with 626 additions and 34 deletions

View File

@ -0,0 +1,3 @@
class Authentication < ActiveRecord::Base
belongs_to :user
end

View File

@ -1,6 +1,9 @@
class Person < ActiveRecord::Base
authenticates_with_sorcery!
has_many :parenthoods
has_many :children, through: :parenthoods
has_many :authentications, dependent: :destroy
accepts_nested_attributes_for :authentications
accepts_nested_attributes_for :children, reject_if: :all_blank
validates :first_name, presence: true
@ -30,4 +33,10 @@ class Person < ActiveRecord::Base
def to_i
id
end
private
## SorceryCore expects the model to hold a crypted_password field
## Since we are only using external oAuth providers, faking this one out.
def crypted_password; end
end