Sha256: 36e637caed45b0e911625ee1aa2eb2afb581197a95579e2f39cb12aac3773845

Contents?: true

Size: 481 Bytes

Versions: 2

Compression:

Stored size: 481 Bytes

Contents

class Application < ActiveRecord::Base
  include Doorkeeper::OAuth::RandomString
  set_table_name 'oauth_applications'

  has_many :access_grants

  validates :name, :secret, :redirect_uri, :presence => true
  validates :uid, :presence => true, :uniqueness => true

  before_validation :generate_uid, :generate_secret, :on => :create

  private
  def generate_uid
    self.uid = unique_random_string_for(:uid)
  end

  def generate_secret
    self.secret = random_string
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
doorkeeper-0.1.1 app/models/application.rb
doorkeeper-0.1.0 app/models/application.rb