Sha256: 2e215ad7ed3fd83932c2c3dd4d53b5021552ead0aaaad77296c6780c7cf18d65

Contents?: true

Size: 693 Bytes

Versions: 5

Compression:

Stored size: 693 Bytes

Contents

class Devise::Oauth2Providable::Client < ActiveRecord::Base
  has_many :access_tokens
  has_many :refresh_tokens
  has_many :authorization_codes

  before_validation :init_identifier, :on => :create, :unless => :identifier?
  before_validation :init_secret, :on => :create, :unless => :secret?
  validates :website, :secret, :presence => true
  validates :name, :presence => true, :uniqueness => true
  validates :identifier, :presence => true, :uniqueness => true

  attr_accessible :name, :website, :redirect_uri

  private

  def init_identifier
    self.identifier = Devise::Oauth2Providable.random_id
  end
  def init_secret
    self.secret = Devise::Oauth2Providable.random_id
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
devise_oauth2_providable-1.1.1 app/models/devise/oauth2_providable/client.rb
devise_oauth2_providable-1.1.0 app/models/devise/oauth2_providable/client.rb
devise_oauth2_providable-1.0.5 app/models/devise/oauth2_providable/client.rb
devise_oauth2_providable-1.0.4 app/models/devise/oauth2_providable/client.rb
devise_oauth2_providable-1.0.3 app/models/devise/oauth2_providable/client.rb