Nesta CMS and Rails3 integration: adding blog to an exiting rails 3 application
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.
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. 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"
...
5. cd nesta-blog
6. run n开发者_StackOverflowesta demo:content
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.
Any suggestion?
Thanks in advance Luca G. Soave
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
I haven't looked into a cleaner way of doing this yet (i.e. avoiding having to specify css and attachments routes as well).
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.
精彩评论