本文介绍了是否有可能包括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 ?

感谢提前
luca

thanks in advanceluca

推荐答案

Hey Luca。我已经有意义写一个一两个月。您只需要将Nesta安装为Rack应用程序,使用Rails Metal。

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.

观察这一点:

您可以在您的路线中引用Nesta,将其称为Nesta :: App(我只合并了允许您一个星期或更早的时间做​​这个工作,所以请确保你是最新的最新代码在github)。为了使这项工作,你所需要做的是要求Nesta的app.rb文件。

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.

我还没有尝试这个与Rails 3自己,但我已经做了一段时间与Rails 2.如果你有任何麻烦,ping我的邮件列表([email protected])。

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]).

对于人想知道如何用Rails 2.3实现相同的东西,我一直在使用看起来像这样的代码(在lib / nesta_metal.rb):

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):

require File.join(File.dirname(__FILE__), *%w[.. vendor nesta app])

class NestaMetal
  def initialize(app)
    @app = app
  end

  def call(env)
    status, headers, response = Nesta::App.call(env)
    (status == 404) ? @app.call(env) : [status, headers, response]
  end
end


$ b b

干杯,

Cheers,

Graham

这篇关于是否有可能包括Nesta CMS到Rails3应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 22:35