Created
February 21, 2011 20:26
-
-
Save pch/837658 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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