2017-04-23 139 views
2

我使用AASM實現了一個訂單系統,但是當我使用rails c來檢查函數時,卻發生了一些錯誤。 NameError: uninitialized constant Order::AASMNameError:未初始化的常量Order:AASM

Bug showed in console

有一個在Gemfile中gem 'aasm'。 我用NameError: uninitialized constant Order::AASM搜索了Google和StackOverflow,但沒有任何工作。

我已重裝bundle installrails s,甚至reboot這臺電腦。 這是我的代碼。

enter image description here

order's gist is here.

如何解決這一問題? 如果我找不到正確的問題,或者您需要更多信息,您能指出它嗎?

回答

0

您可能希望在您的問題中包含更多代碼 - 整個aasm區塊。

另外,嘗試確定你申請你的AASM狀態到模型數據庫列:

aasm :column => 'state' 
    state :active 
    state :completed 
    state :scheduled 
2

試試這個:

  1. 註釋掉gem 'spring'gem 'spring-watcher-listen', '~> 2.0.0'

  2. 運行bundle install

或者嘗試在您的項目升級春:

  1. 在你的Gemfile gem 'spring', '~> 2.0', '>= 2.0.2'
  2. 運行bundle update spring
+0

防守好像它與'spring'的問題。我的項目中沒有'spring-watcher-listen',但仍然存在問題。評論它修復它。 – dft

相關問題