Module: OmniAuth::Identity::Models::CouchPotatoModule

Defined in:
lib/omniauth/identity/models/couch_potato.rb

Overview

CouchPotato is an ORM adapter for CouchDB:

https://github.com/langalex/couch_potato

NOTE: CouchPotato is based on ActiveModel. NOTE: CouchPotato::Persistence must be included before OmniAuth::Identity::Models::CouchPotatoModule NOTE: Includes “Module” in the name for invalid legacy reasons. Rename only with a major version bump.

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/omniauth/identity/models/couch_potato.rb', line 14

def self.included(base)
  base.class_eval do
    include ::OmniAuth::Identity::Model
    include ::OmniAuth::Identity::SecurePassword

    has_secure_password

    def self.auth_key=(key)
      super
      validates_uniqueness_of key, case_sensitive: false
    end

    def self.locate(search_hash)
      where(search_hash).first
    end

    def save
      CouchPotato.database.save(self)
    end
  end
end