Hi all,
I'm new to the comatose plugin and am looking to integrate it into a
rails 2.1.2 app. I found a bug yesterday and filed it:
http://code.google.com/p/comatose-plugin/issues/detail?id=41
Basically when you fire up your rails app and hit CMS pages it is
unable to find the comatose layout file. (Does anyone else see this
same bug?) However if you hit the comatose admin controller and then
hit the CMS pages it finds the templates just fine. After some
debugging I made a change that fixes it locally but I wanted to see if
there's something that I'm not aware of that would be broken by my
fix.
Basically I take out the relative path that's defined to the comatose
layout and instead just append the comatose views directory to the
view path. This fixes the problem but like I said I'm not sure if
there's something else that might break as a result that's why I
figured it would be good to ask.
My diff is below:
diff --git a/lib/comatose_controller.rb b/lib/comatose_controller.rb
index 625fb51..5b29d51 100644
--- a/lib/comatose_controller.rb
+++ b/lib/comatose_controller.rb
@@ -84,11 +84,7 @@ protected
# Returns a path to plugin layout, if it's unspecified, otherwise
# a path to an application layout...
def get_page_layout
- if params[:layout] == 'comatose_content'
- File.join(plugin_layout_path, params[:layout])
- else
- params[:layout]
- end
+ params[:layout]
end
# An after_filter implementing page caching if it's enabled,
globally,
@@ -112,8 +108,8 @@ protected
response.headers["Content-Type"] = "text/html; charset=#
{Comatose.config.content_type}" unless
Comatose.config.content_type.nil? or response.headers['Statu
end
- # Path to layouts within the plugin... Assumes the plugin directory
name is 'comatose'
- define_option :plugin_layout_path, File.join( '..', '..', '..',
'vendor', 'plugins', 'comatose', 'views', 'layouts' )
+ COMATOSE_VIEW_PATH = File.join(RAILS_ROOT, 'vendor', 'plugins',
'comatose', 'views')
+ ActionController::Base.append_view_path(COMATOSE_VIEW_PATH) unless
ActionController::Base.view_paths.include?(COMATOSE_VIEW_PATH)