Sha256: 485d78bae241400aa1c74b9844409d63f395ab4999c1c99d0a8fb49fcc153a5c

Contents?: true

Size: 421 Bytes

Versions: 17

Compression:

Stored size: 421 Bytes

Contents

module DeviseTokenAuth::Concerns::MongoidSupport
  extend ActiveSupport::Concern

  def as_json(options = {})
    options[:except] = (options[:except] || []) + [:_id]
    hash = super(options)
    hash['id'] = to_param
    hash
  end

  class_methods do
    # It's abstract replacement .find_by
    def dta_find_by(attrs = {})
      find_by(attrs)
    rescue Mongoid::Errors::DocumentNotFound
      nil
    end
  end
end

Version data entries

17 entries across 17 versions & 6 rubygems

Version Path
devise_token_auth-1.2.4 app/models/devise_token_auth/concerns/mongoid_support.rb
devise_token_auth-1.2.2 app/models/devise_token_auth/concerns/mongoid_support.rb
devise_token_auth-1.2.1 app/models/devise_token_auth/concerns/mongoid_support.rb
devise_token_auth-1.2.0 app/models/devise_token_auth/concerns/mongoid_support.rb
devise_token_auth-1.1.5 app/models/devise_token_auth/concerns/mongoid_support.rb
sidecar_token_auth-1.0.1 app/models/devise_token_auth/concerns/mongoid_support.rb
devise_token_auth-1.1.4 app/models/devise_token_auth/concerns/mongoid_support.rb
devise_token_auth_multitenancy-1.1.3.2 app/models/devise_token_auth/concerns/mongoid_support.rb
devise_token_auth_multitenancy-1.1.3.1 app/models/devise_token_auth/concerns/mongoid_support.rb
devise_token_auth_multitenancy-1.1.3.alpha1 app/models/devise_token_auth/concerns/mongoid_support.rb
devise-tokens-1.0.4 app/models/devise_token_auth/concerns/mongoid_support.rb
devise_token_auth-1.1.3 app/models/devise_token_auth/concerns/mongoid_support.rb
devise_token_auth-1.1.2 app/models/devise_token_auth/concerns/mongoid_support.rb
devise_token_auth-1.1.1 app/models/devise_token_auth/concerns/mongoid_support.rb
devise_token_auth-1.1.0 app/models/devise_token_auth/concerns/mongoid_support.rb
devise_token_auth_fork_dfabarbosa-1.0.0 app/models/devise_token_auth/concerns/mongoid_support.rb
devise_token_auth_skycocker_fork-1.0.0 app/models/devise_token_auth/concerns/mongoid_support.rb