问题描述
我要添加nesta(0.9.8)cms到现有的Rails 3.0.10应用程序。
I'm adding nesta (0.9.8) cms, to an existing Rails 3.0.10 application. I get the blog up and running but not the layout/stylesheets.
到目前为止,我做的是:
1.在rails应用程序主根,添加gem 'nesta',gem'sass'and run
'bundle'
2.运行nesta new nesta-blog
3.编辑config.ru如下:
What i did until now is : 1. inside rails app main root, add gem 'nesta', gem 'sass' and run 'bundle'
2. run "nesta new nesta-blog" 3. edit config.ru like following :
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如下:
4. edit config/routes.rb like following :
require 'nesta/env'
require 'nesta/app'
Rails3MongoidOmniauthSimple::Application.routes.draw do
mount Nesta::App.new => "/blog"
root :to => "home#index"
...
cd nesta-blog
6.运行 nesta demo:content
5. cd nesta-blog 6. run nesta demo:content
现在, c / c $ c> rails s 从您的〜/ main-rails应用程式,前往你会看到演示nesta网站但没有他的默认布局/样式表,而如果你从里面运行 shotgun config.ru
〜/ main-rails-app / nesta-blog,要进行一切正常显示。
Now, if you run rails s
from your ~/main-rails-app, going to http://localhost:3000/blog you will see the the demo nesta site but without his default layout/stylesheets, while if you run shotgun config.ru
from inside ~/main-rails-app/nesta-blog, going to http://localhost:9393/ everything shows up correctly.
有任何建议吗?
提前感谢
Luca G. Soave
Thanks in advanceLuca G. Soave
推荐答案
我还没有到我想要的插件级别的水平,但我在我的Rails上运行Nesta 3.0网站添加到config / routes.rb:
I've not got this to the level of plug-n-play that I'd like yet, but I'm running Nesta on my Rails 3.0 sites by adding this to config/routes.rb:
mount Nesta::App, :at => '/'
match '/css/*style.css' => Nesta::App
match '/attachments/*file' => Nesta::App
我还没有研究一个更清洁的方法指定css和附件路由)。
I haven't looked into a cleaner way of doing this yet (i.e. avoiding having to specify css and attachments routes as well).
我在位于#{Rails.root} / nesta的目录中创建了Nesta应用程序。我还需要一个config / initializers / nesta.rb:
I created my Nesta app in a directory located at "#{Rails.root}/nesta". I also needed an in config/initializers/nesta.rb:
require "nesta/env"
Nesta::Env.root = ::File.expand_path("../../nesta",
File.dirname(__FILE__))
我很喜欢你这样做的方式。
I quite like the way you've done it too.
这篇关于Nesta CMS和Rails3集成:将博客添加到现有rails 3应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!