在Rails 3中安装同一引擎的多个实例 [英] Mounting multiple instances of the same engine in Rails 3

查看:77
本文介绍了在Rails 3中安装同一引擎的多个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想利用Rails 3的体系结构更改所提供的新的模块化前景.但是,不像大多数示例中那样仅安装引擎...

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?

谢谢, tur

推荐答案

我的直言不讳,因为第一个实现的命名空间会踩到第二个实现的脚步.虽然既然文件是相同的,但我想那没关系吗?你到底是怎么过的?

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?

这篇关于在Rails 3中安装同一引擎的多个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆