我正在修补concern in the Devise Token Auth gem。
我让它在alias_method_chain上工作,但我想知道在这种情况下是否可以使用module#prepend?
注意:我们使用的是ruby 2.2.x
现有:
DeviseTokenAuth::Concerns::User.module_eval do
def token_validation_response_with_customer_info
json = token_validation_response_without_customer_info
# add some customer stuff based on has_role? check
json
end
alias_method_chain :token_validation_response, :customer_info
end发布于 2016-01-21 20:10:02
你可以试试
DeviseTokenAuth::Concerns::User.prepend(
Module.new do
def token_validation_response
json = super
# add some customer stuff based on has_role? check
json
end
end
)https://stackoverflow.com/questions/32056529
复制相似问题