Skip to content

Instantly share code, notes, and snippets.

@joshuacronemeyer
Created October 29, 2012 17:55
Show Gist options
  • Save joshuacronemeyer/3975250 to your computer and use it in GitHub Desktop.
Save joshuacronemeyer/3975250 to your computer and use it in GitHub Desktop.
Add refinery blog to a rails app
class ApplicationController < ActionController::Base
# ...snip...
before_filter :check_for_refinery_controller
layout :set_layout_for_appname_or_refinery
def check_for_refinery_controller
@refinery_controller = false
my_class_name = self.class.name
return if my_class_name.index("::").nil?
@refinery_controller = true if my_class_name.split("::").first == "Refinery"
end
def set_layout_for_appname_or_refinery
return "application" if @refinery_controller
return "appname" if !@refinery_controller
end
# ...snip...
#gemfile snippet for adding refinery 2.0.8 to rails 3.2.8 app
gem 'rails', '3.2.8'
#...
#refinery dependencies
gem 'refinerycms', '2.0.8'
gem 'refinerycms-blog', '~> 2.0.0'
gem 'will_paginate'
#...
gem "jquery-rails", "~> 2.0.0" #older version of jquery rails because refinerycms-blog depends on it.
#snip...
#mount refinery at the cms subdirectory
mount Refinery::Core::Engine, :at => '/cms'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment