Sha256: 56e2f225a93b1e3961e87ae8a3754f7117353443cd1e2b8d56ea002a885688ad

Contents?: true

Size: 549 Bytes

Versions: 13

Compression:

Stored size: 549 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 :name, :website, :redirect_uri, :secret, :presence => true
  validates :identifier, :presence => true, :uniqueness => true

  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

13 entries across 13 versions & 1 rubygems

Version Path
devise_oauth2_providable-0.3.7 app/models/client.rb
devise_oauth2_providable-0.3.6 app/models/client.rb
devise_oauth2_providable-0.3.5 app/models/client.rb
devise_oauth2_providable-0.3.4 app/models/client.rb
devise_oauth2_providable-0.3.3 app/models/client.rb
devise_oauth2_providable-0.3.2 app/models/client.rb
devise_oauth2_providable-0.3.1 app/models/client.rb
devise_oauth2_providable-0.3.0 app/models/client.rb
devise_oauth2_providable-0.2.4 app/models/client.rb
devise_oauth2_providable-0.2.3 app/models/client.rb
devise_oauth2_providable-0.2.2 app/models/client.rb
devise_oauth2_providable-0.2.1 app/models/client.rb
devise_oauth2_providable-0.2.0 app/models/client.rb