Skip to content

Instantly share code, notes, and snippets.

@romansklenar
Created January 30, 2013 23:50
Show Gist options
  • Save romansklenar/4678504 to your computer and use it in GitHub Desktop.
Save romansklenar/4678504 to your computer and use it in GitHub Desktop.
Devise template inheritance resolver
# 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