我已經把:render_component替代在routes.rb中
map.connect '/:alias', :controller => 'cores' ,:action=>"view"
這個別名是連接有3個型號:在我的核心控制器,我用render_component相對於該模型的描繪事件的地方和藝術家 。
if(core = Core.find(:first, :conditions => ["alias = ?", params[:alias]]))
type = core.class.to_s.downcase
render_component(:controller => type,
:action => "view",
:id => core.id.to_s,
:params => params)
end
在rails 2.3中render_component已被棄用。但是,這樣做的解決方案是什麼?
我看到有一個插件用於重用render_component,但我想知道另一個解決方案。
謝謝。