Class: RestfulRouteVersion::InheritedViewResolver

Inherits:
ActionView::FileSystemResolver
  • Object
show all
Defined in:
lib/restful_route_version/inherited_view_resolver.rb

Instance Method Summary collapse

Instance Method Details

#find_templates(name, prefix, partial, details) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/restful_route_version/inherited_view_resolver.rb', line 12

def find_templates(name, prefix, partial, details)
  klass = "#{prefix}_controller".camelize.constantize rescue nil

  return [] if !klass || !(klass < ActionController::Base)

  ancestor = klass.ancestors.second
  ancestor_prefix = ancestor.name.gsub(/Controller$/, '').underscore

  templates = super(name, ancestor_prefix, partial, details)
  return templates if templates.present?
  find_templates(name, ancestor_prefix, partial, details)
end