Sha256: 90bf7ad7890ab727bc727706ca88b3cf526aa353441f26974852f428fa806a27

Contents?: true

Size: 1019 Bytes

Versions: 11

Compression:

Stored size: 1019 Bytes

Contents

require 'active_support'

# :nodoc: namespace
module Authpwn

# Included by the model class that roots various credentials.
#
# Parts of the codebase assume the model will be named Credential.
module CredentialModel
  extend ActiveSupport::Concern

  included do
    # The user whose token this is.
    belongs_to :user, inverse_of: :credentials
    validates :user, presence: true

    # Name that can be used to find the token.
    validates :name, length: { in: 1..128, allow_nil: true },
                     uniqueness: { scope: [:type], allow_nil: true }

    # Secret information associated with the token.
    validates :key, length: { in: 1..2.kilobytes, allow_nil: true }

    if ActiveRecord::Base.respond_to? :mass_assignment_sanitizer=
      attr_accessible
    end
  end

  # Included in the metaclass of models that call pwnauth_facebook_token_model.
  module ClassMethods

  end  # module Authpwn::FacebookTokenModel::ClassMethods

end  # namespace Authpwn::FacebookTokenModel

end  # namespace Authpwn

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
authpwn_rails-0.16.2 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.16.1 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.16.0 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.15.3 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.15.2 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.15.1 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.15.0 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.14.3 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.14.2 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.14.1 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.14.0 lib/authpwn_rails/credential_model.rb