Sha256: 06e78b92d07935cedd780d2c97103960834375e7985ea995317efa1e334fefcb

Contents?: true

Size: 720 Bytes

Versions: 4

Compression:

Stored size: 720 Bytes

Contents

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

  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, :user

  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

4 entries across 4 versions & 1 rubygems

Version Path
anjlab-devise-oauth2-providable-1.1.3 app/models/devise/oauth2_providable/client.rb
anjlab-devise-oauth2-providable-1.1.2 app/models/devise/oauth2_providable/client.rb
anjlab-devise-oauth2-providable-1.1.1 app/models/devise/oauth2_providable/client.rb
anjlab-devise-oauth2-providable-1.1.0 app/models/devise/oauth2_providable/client.rb