您是否知道如何覆盖Doorkeeper::Application
Doorkeeper gem 提供的覆盖。假设我想添加验证、回调等。Db 表名为auth_applications
.
我创建了一个名为 application.rb 的模型,其中包含以下内容,但未触发我的 before_create 调用。最好的方法是什么?
module Doorkeeper
class Application < ActiveRecord::Base
include ApplicationMixin
require 'identicon'
before_create :generate_identicon
def generate_identicon
self.identicon = Identicon.data_url_for name, 128, [255, 255, 255]
end
end
end
根据此 SO 答案代码应声明为初始化程序。但是我想要一个经典模型,因为我想添加很多东西。