Skip to content

Instantly share code, notes, and snippets.

@pch
Created February 21, 2011 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pch/837658 to your computer and use it in GitHub Desktop.
Save pch/837658 to your computer and use it in GitHub Desktop.
module Devise
module Controllers
module ScopedViews
protected
# Monkey path for generating proper templates path when dealing with
# namespaced resources and custom views.
def render_with_scope(action, options={})
controller_name = options.delete(:controller) || self.controller_name
if self.class.scoped_views?
begin
render :template => "#{devise_mapping.fullpath}/#{controller_name}/#{action}"
rescue ActionView::MissingTemplate
render :template => "#{controller_path}/#{action}"
end
else
render :template => "#{controller_path}/#{action}"
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment