Sha256: 0675ca2bd1d919307efb07ba87986b415f82158ce2e7c3f7744b769fe449b9eb

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

class Client < ActiveRecord::Base
  has_many :access_tokens
  has_many :refresh_tokens

  before_validation :init_identifier, :on => :create, :unless => :identifier?
  before_validation :init_secret, :on => :create, :unless => :secret?
  validates :website, :redirect_uri, :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

1 entries across 1 versions & 1 rubygems

Version Path
devise_oauth2_providable-0.3.8 app/models/client.rb