Module: OmniAuth::Identity::Models::NoBrainer

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

Overview

NoBrainer is an ORM adapter for RethinkDB:

http://nobrainer.io/

NOTE: NoBrainer is based on ActiveModel.

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/omniauth/identity/models/nobrainer.rb', line 12

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

    # validations: true (default) incurs a dependency on ActiveModel, but NoBrainer is ActiveModel based.
    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
  end
end