2017-06-02 88 views
0

我試圖從http://localhost:3000/api/v1/oauth/applications刪除我的一個應用程序時收到以下錯誤消息。NameError(未初始化的常量Mongoid :: Relations :: Cascading :: DeleteAll):

Started DELETE "/api/v1/oauth/applications/5930bd2aa54dd321f7248178" for ::1 
at 2017-06-01 21:53:22 -0400 
Processing by Doorkeeper::ApplicationsController#destroy as HTML 
Parameters: {"utf8"=>"✓", 
"authenticity_token"=>"+IxdEDUYW65Hj99VUqdJ/rydjZjJE8CIFy7El5KuuZ0rf36wLE0M4qJxBUL61D1IeRW+VvgWw1o9ckXxpHBkVw==", "commit"=>"Destroy", "id"=>"5930bd2aa54dd321f7248178"} 
MONGODB | localhost:27017 | playco_development.find | STARTED | {"find"=>"oauth_applications", "filter"=>{"_id"=>BSON::ObjectId('5930bd2aa54dd321f7248178')}} 
MONGODB | localhost:27017 | playco_development.find | SUCCEEDED | 0.000784s 
Completed 500 Internal Server Error in 9ms 

NameError (uninitialized constant Mongoid::Relations::Cascading::DeleteAll): 
    activesupport (4.2.8) lib/active_support/inflector/methods.rb:263:in `const_get' 
    activesupport (4.2.8) lib/active_support/inflector/methods.rb:263:in `block in constantize' 
    activesupport (4.2.8) lib/active_support/inflector/methods.rb:259:in `each' 
    activesupport (4.2.8) lib/active_support/inflector/methods.rb:259:in `inject' 
    activesupport (4.2.8) lib/active_support/inflector/methods.rb:259:in `constantize' 
    activesupport (4.2.8) lib/active_support/core_ext/string/inflections.rb:66:in `constantize' 
    mongoid (5.2.1) lib/mongoid/relations/metadata.rb:98:in `cascade_strategy' 
    mongoid (5.2.1) lib/mongoid/relations/cascading.rb:30:in `block in cascade!' 

下面是我使用的寶石是相關的mongoid扶手:

gem 'rails', '4.2.8' 
gem 'mongoid', '~> 5.2.1' 
gem 'doorkeeper-mongodb', github: 'doorkeeper-gem/doorkeeper-mongodb' 
gem "doorkeeper-grants_assertion", github: "doorkeeper-gem/doorkeeper-grants_assertion" 

這只是試圖「破壞」從UI現有的應用程序時發生。

任何幫助將不勝感激。

回答

0

該問題源於gem 'doorkeeper-mongodb',要求gem 'doorkeeper'版本> = 4.00。大於v3.1.0的gem 'doorkeeper'版本具有dependent: :delete_all關聯(請參閱門衛gem文件中的doorkeeper/lib/doorkeeper/models/application_mixin.rb)。到目前爲止,任何版本的Mongoid都不支持:delete_all的級聯關係,並引發了NameError異常。

我解決了這個問題,要求gem 'doorkeeper', '~> 3.1.0'。然而,這導致了與gem 'doorkeeper-grants_assertion'的gem依賴關係問題,我通過請求我的gem文件中的特定提交版本來修復,如下所示:

gem 'mongoid', '~> 5.1.0' 
gem 'doorkeeper-mongodb', github: 'doorkeeper-gem/doorkeeper-mongodb' 
gem 'doorkeeper', '~> 3.1.0' 
gem 'doorkeeper-grants_assertion', github: "doorkeeper-gem/doorkeeper- 
grants_assertion", :ref => 'f4391f2f07d96845db0d9dd6889f58d4bd4d23bb' 
相關問題