Nesta CMS和Rails3集成:将博客添加到现有的rails 3应用程序中
我将nesta(0.9.8)cms添加到现有的Rails 3.0.10应用程序中。 我启动并运行了博客,但没有布局/样式表。
我到目前为止所做的是:1。在rails app main root中,添加gem’natea’,gem’sass’并运行’bundle’
2.运行“nesta new nesta-blog”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 nesta-blog 6.运行nesta demo:content
现在,如果您从〜/ main-rails-app运行rails s
,转到http:// localhost:3000 / blog,您将看到demo nesta站点但没有他的默认布局/样式表,而如果您运行shotgun config.ru
来自〜/ main-rails-app / nesta-blog,转到http:// localhost:9393 /一切都显示正确。
有什么建议吗?
在此先感谢Luca G. Soave
我还没有达到我想要的即插即用级别,但我在我的Rails 3.0网站上运行Nesta,将其添加到config / routes.rb:
mount Nesta::App, :at => '/' match '/css/*style.css' => Nesta::App match '/attachments/*file' => Nesta::App
我还没有考虑过这样做的更简洁的方法(即避免必须指定css和附件路由)。
我在位于“#{Rails.root} / nesta”的目录中创建了我的Nesta应用程序。 我还需要一个config / initializers / nesta.rb:
require "nesta/env" Nesta::Env.root = ::File.expand_path("../../nesta", File.dirname(__FILE__))
我非常喜欢你这样做的方式。