【问题标题】:Nesta CMS and Rails3 integration: adding blog to an exiting rails 3 applicationNesta CMS 和 Rails3 集成:将博客添加到现有的 rails 3 应用程序
【发布时间】:2011-08-23 20:24:10
【问题描述】:

我正在将nesta (0.9.8) cms 添加到现有的Rails 3.0.10 应用程序中。我让博客启动并运行,但布局/样式表没有。

到目前为止我所做的是: 1. 在 Rails 应用程序主根目录中,添加 gem 'nesta'、gem 'sass' 并运行 '捆绑'
2.运行“内斯塔新内斯塔博客” 3. 编辑 config.ru 如下:

require ::File.expand_path('../config/environment',  __FILE__)
map "/" do
 run MyRails3App::Application
end

require 'nesta/env'
require 'nesta/app'

Nesta::App.root = ::File.expand_path('./nesta-blog', ::File.dirname(__FILE__))
map "/blog" do
 run Nesta::App
end

4。编辑 config/routes.rb 如下:

require 'nesta/env'
require 'nesta/app'

Rails3MongoidOmniauthSimple::Application.routes.draw do

 mount Nesta::App.new => "/blog"
 root :to => "home#index"
...

5。 cd内斯塔博客 6.运行nesta demo:content

现在,如果您从 ~/main-rails-app 运行 rails s,转到 http://localhost:3000/blog,您将看到演示内斯塔站点,但没有他的默认布局/样式表,而如果您从 ~/main-rails-app 运行 shotgun config.ru在 ~/main-rails-app/nesta-blog 中,转到 http://localhost:9393/ 一切都正确显示。

有什么建议吗?

提前致谢 卢卡·G·索阿夫

【问题讨论】:

    标签: ruby-on-rails ruby ruby-on-rails-3 content-management-system nestacms


    【解决方案1】:

    我还没有达到我想要的即插即用级别,但是我通过将它添加到 config/routes.rb 来在我的 Rails 3.0 站点上运行 Nesta:

    mount Nesta::App, :at => '/'
    match '/css/*style.css' => Nesta::App
    match '/attachments/*file' => Nesta::App
    

    我还没有研究过更简洁的方法(即避免同时指定 css 和附件路由)。

    我在位于“#{Rails.root}/nesta”的目录中创建了我的 Nesta 应用程序。我还需要一个 in config/initializers/nesta.rb:

    require "nesta/env"
    Nesta::Env.root = ::File.expand_path("../../nesta",
                                         File.dirname(__FILE__))
    

    我也很喜欢你的做法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-21
      • 1970-01-01
      • 2011-01-22
      • 2012-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多