1
我怎麼能創建動作控制器,它確實像一個mixin:ActionController的密新
layout Proc.new { |controller|
if controller.request.xhr?
'minimal'
else
'application'
end
}
(我不能繼承的ApplicationController,因爲我使用的寶石(設計),這是綁的ActionController 。mixin似乎更適合)
我創建了一個名爲「XHRController」的模塊,並在application.rb中使用了「ApplicationController :: Base.include XHRController」,但它在任何使用「layout」時出錯, 「before_filter」等未定義。
感謝傑西。這是它的一部分,我也使用before_filter插入自定義標題。 – mahemoff 2011-12-19 07:09:39