是否可以将 Nesta CMS 包含到 Rails3 应用程序中?
我想将 Nesta CMS 应用程序“安装”到 Rails3 应用程序上 这可能是 Nesta Sinatra 应用程序的原因,它应该是机架可安装层,...但是您会怎么做? 你将从哪里开始?有人有关于这个话题的经验吗?建议的文档?
I'd like "to mount" a Nesta CMS app onto a Rails3 app This should be possible couse of being Nesta a Sinatra app, which should be a Rack mountable layer, ... but how would you do it ?
Where will you start from ? Does anybody has experiences on this topic ? Suggested docs ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
嘿卢卡。我一两个月以来一直想写这篇文章。您只需使用 Rails Metal 将 Nesta 安装为 Rack 应用程序即可。
观看此内容:
http://railscasts.com/episodes/222-rack -in-rails-3
您将能够在路线中通过将其称为 Nesta::App 来引用 Nesta(我大约一周前才将允许您执行此操作的提交合并到 master 中) ,因此请确保您掌握了 github 上的最新代码)。为了实现这一点,您所需要做的就是需要 Nesta 的 app.rb 文件。
我自己还没有在 Rails 3 上尝试过这一点,但我已经在 Rails 2 上尝试了一段时间了。如果您遇到任何问题,请在邮件列表上联系我 ([电子邮件受保护])。
对于想知道如何使用 Rails 2.3 实现相同目标的人,我一直在使用如下代码(在 lib/nesta_metal.rb 中):
干杯,
Graham
Hey Luca. I've been meaning to write this up a for a month or two. You just need to mount Nesta as a Rack app, using Rails Metal.
Have a watch of this:
http://railscasts.com/episodes/222-rack-in-rails-3
You'll be able to refer to Nesta in your routes by referring to it as Nesta::App (I only merged the commit that allows you to do this into master a week or so ago, so make sure you're up to date with the latest code on github). In order to make that work, all you should need to do is to require Nesta's app.rb file.
I'm yet to try this with Rails 3 myself, but I've been doing it for a while with Rails 2. If you have any trouble, ping me on the mailing list ([email protected]).
For people wondering how to achieve the same thing with Rails 2.3, I've been using code that looks like this (in lib/nesta_metal.rb):
Cheers,
Graham
这是我用来让它在我的应用程序上工作的代码:
当时它还需要 github 上的最新版本的 Sinatra,因为通过 rubygems 提供的版本在处理环境变量的方式上有一个错误,所以我将其添加到我的 Gemfile 中:
Here's the code I used to make it work on my app:
At the time it also required the latest version of Sinatra from github as the version available via rubygems had a bug in how it handled environment variables, so I added this to my Gemfile: