- Add the refinery blog dependencies to my Gemfile
- Tweak rails dependencies to mesh with refinery dependencies
- Generate refinery and refinery blog stuff
- Fix routes
- Fix layouts that refinery destroys
Here is a gemfile snippet that shows what I added to make step 1 and 2 happen. The only trouble I had was that refinery depends on an older version of jquery-rails than rails 3.2.8. Bundler kept installing an ancient version of refinery because i guess it's dependency rules were more liberal. Make sure you get a version of refinery that is greater than 2.Once you have those dependencies you generate the refinery CMS.
rails generate refinery:cms --fresh-installationThat will create lots of stuff, migrate and seed your db, and it will also delete your application layout. Not a big deal if you are using git, we can put things right. Before we do that let's just generate the blog too.
rails generate refinery:blog rake db:migrate rake db:seedOk, more stuff generated, migrated and seeded. Refinery has installed itself in the root of our application's routes so let's put it in a subdirectory. Open up routes.rb and change the refinery mount to have a different 'at' location. Now notice that refinery has deleted your application layout. You probably want to have separate layouts for your existing application and the refinery application. What I did was to use git to bring back my old layout and then I renamed it to appname.html.erb Then inside application_controller.rb I dynamically set the layout as follows: This basically checks to see if the controller is inside the Refinery module and if it is it sets the appropriate layout. Refinery uses the default layout (which shouldn't exist in your project because it is set inside the refinery engine).
And that is pretty much it. My blog shows up at "/cms/blog". My app is still at "/". And refinery's admin stuff is found at "/cms/refinery".