2012-03-22 41 views
0

錯誤消息: 未定義的方法`ADMINUSER」爲#(NoMethodError) 異常類: PhusionPassenger ::不明錯誤紅寶石上的Phusion NoMethod錯誤機架表名

ADMINUSER是在我的分貝的表。最糟糕的部分是,我從來沒有使用過這個表,也沒有從我的代碼中調用它。

class AdminUser < ActiveRecord::Base 
has_and_belongs_to_many :pages 
    scope :named, lambda {|first,last| where(:first_name => first, :last_name => last)} 

end 

而且page.rb型號

class Page < ActiveRecord::Base 

    belongs_to :subject 
    has_many :sections 
    has_and_belongs_to_many :editors, :class_name => "AdminUser" 
end 

而且在section.rb型號

class Section < ActiveRecord::Base 

    AdminUser has_and_belongs_to_many :pages 
    belongs_to :page 

end 

這就是 - ,我甚至提ADMINUSER是我admin_user.rb車型唯一的地方它。還有另外0個AdminUser提到 - 這是我甚至沒有開始在我的應用程序中使用的東西。 我在本地運行我的應用程序時沒有問題,但在Ubuntu上,Passenger和Apache2下,Phusion拒絕加載我的應用程序。 (我對RoR和Ubuntu(基於Linux的操作系統)相當新) - 但是,我確實運行了rake db:migrate,是的,我確實安裝了Passenger作爲寶石,並且我使用的是mysql2 gem連接到我的分貝。當然,我在Ubuntu上安裝並啓動了mysql服務。 (另外,我確實創建了數據庫,用戶,並且 - 基本上rake db:migrate工作了100%)。

你能幫我嗎,我正在放鬆心情 - 現在已經有這個問題2天了 - 而且不知道在哪裏看。

環境:Rails的3.2.2,1.9.3的Ruby-P125

回答

0

嘗試從section.rb

+0

嗯去除AdminUser刪除所有我得到的是標準500.html - 出事了 - 沒有關於日誌它... – AplusB 2012-03-22 05:51:08

+0

好,所以問題是上面的代碼在開發中工作,但在生產中引發錯誤...任何人都可以解釋爲什麼? – AplusB 2012-03-23 03:18:17

+0

也許是因爲在生產中,導軌會預加載所有類。 section.rb是否在開發過程中加載過?即你在開發中是否積極使用'Section'? – 2012-03-23 03:33:47