当我使用此代码时:
@access_token = Doorkeeper::AccessToken.create!({
:application_id => grant.application_id,
:resource_owner_id => grant.resource_owner_id,
:scopes => grant.scopes_string,
:expires_in => server.access_token_expires_in,
:use_refresh_token => server.refresh_token_enabled?,
:meta => grant.meta
})
未保存:meta
参数。当我使用这段代码时:
@access_token = Doorkeeper::AccessToken.new({
:application_id => grant.application_id,
:resource_owner_id => grant.resource_owner_id,
:scopes => grant.scopes_string,
:expires_in => server.access_token_expires_in,
:use_refresh_token => server.refresh_token_enabled?
})
@access_token.meta = grant.meta
@access_token.save!
{I} :meta
参数按我的预期保存。这两个代码片段有什么区别?
答案 0 :(得分:4)
您需要允许meta
的{{1}}属性:
mass assignment