Mounting multiple instances of the same engine in Rails 3

北战南征 提交于 2019-12-07 11:58:56

问题


I'm wanting to make use of the new modularity prospects offered by the architecture changes in rails 3. However, rather than just mount an engine as in the majority of examples...

Rails.application.routes.draw do
  match "/blog" => Rack::Blog
end

...I'd like to mount multiple versions of the same engines, and have those instances independently configured. Something along the lines of...

Rails.application.routes.draw do
  match "/news" => Blog.new("path/to/blog_1/config")
  match "/blog" => Blog.new("path/to/blog_2/config")
end

Is this sort of functionality catered for? Has anyone implemented anything similar?

Thanks, fturtle


回答1:


My gut tells me no, because the namespacing of the first implementation would step on the toes of the second. Though since the files would be the same I guess that wouldn't matter? How did you get on in the end?



来源:https://stackoverflow.com/questions/3312892/mounting-multiple-instances-of-the-same-engine-in-rails-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!