Sha256: b51ebce188aa59865717ff032affde1c428c9e9e48af0c0a60248c47570e8eb8

Contents?: true

Size: 863 Bytes

Versions: 2

Compression:

Stored size: 863 Bytes

Contents

# frozen_string_literal: true

require "nobrainer"

module OmniAuth
  module Identity
    module Models
      # NoBrainer is an ORM adapter for RethinkDB:
      #   http://nobrainer.io/
      # NOTE: NoBrainer is based on ActiveModel.
      module NoBrainer
        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
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omniauth-identity-3.1.1 lib/omniauth/identity/models/nobrainer.rb
omniauth-identity-3.1.0 lib/omniauth/identity/models/nobrainer.rb