Created
January 30, 2013 23:50
-
-
Save romansklenar/4678504 to your computer and use it in GitHub Desktop.
Devise template inheritance resolver
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
| # Use only in devise overriden controllers to ensure template inheritance. | |
| # Appending resolver will try to find template in app/views/users/passwords/new | |
| # and it doesn't then it will fallback to app/views/devise/passwords/new | |
| # | |
| # ==== Usage | |
| # | |
| # class Users::PasswordsController < ::Devise::PasswordsController | |
| # append_view_path DeviseResolver.new | |
| # end | |
| # | |
| class DeviseResolver < ::ActionView::FileSystemResolver | |
| def initialize | |
| super("app/views/devise") | |
| end | |
| def find_templates(name, prefix, partial, details) | |
| prefix = prefix.split('/') | |
| prefix.shift | |
| prefix = prefix.join('/') | |
| super(name, prefix, partial, details) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment