close
今天發現一個只有在 Passenger 上才會遇到的問題。
原本在 config/environment.rb 裡的程式碼:
在本機端測試沒有問題,卻在 Server 端發現出現以下的錯誤
undefined method `chinese_permalink' for #
後來 trace error_log 發現是在 environment.rb 那裡出錯,
看了一下想是不是應該在 initialize 前就做
ActiveRecord::Base.send :include, ChinesePermalink
試了之後果然得到正確的結果。
我想這應該是 passenger 在處理 rails boot 的 require 順序有所不同造成的,
查了一下大概找到有文章在討論這個: 研究 Rails 3 的 boot process 和 initialization process
先記下來,再找個時間來讀
原本在 config/environment.rb 裡的程式碼:
在本機端測試沒有問題,卻在 Server 端發現出現以下的錯誤
undefined method `chinese_permalink' for #
後來 trace error_log 發現是在 environment.rb 那裡出錯,
看了一下想是不是應該在 initialize 前就做
ActiveRecord::Base.send :include, ChinesePermalink
試了之後果然得到正確的結果。
我想這應該是 passenger 在處理 rails boot 的 require 順序有所不同造成的,
查了一下大概找到有文章在討論這個: 研究 Rails 3 的 boot process 和 initialization process
先記下來,再找個時間來讀
全站熱搜
留言列表