Sha256: d5e6dad2bbbb64f4355a9d7f57b4e759f705370d7d73cdd3088ccafdc298ad57

Contents?: true

Size: 695 Bytes

Versions: 5

Compression:

Stored size: 695 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 & 2 rubygems

Version Path
mustwin_devise_oauth2_providable-1.1.6 app/models/devise/oauth2_providable/client.rb
mustwin_devise_oauth2_providable-1.1.5 app/models/devise/oauth2_providable/client.rb
mustwin_devise_oauth2_providable-1.1.4 app/models/devise/oauth2_providable/client.rb
mustwin_devise_oauth2_providable-1.1.3 app/models/devise/oauth2_providable/client.rb
devise_oauth2_providable-1.1.2 app/models/devise/oauth2_providable/client.rb