Skip to content

Commit 70fc010

Browse files
authored
Add support for packs and internal engines (#56)
When using packs or internal engines, the template paths may not be nested directly under the Rails root `app/views` directory. For example, the default for [packs-rails](https://github.com/rubyatscale/packs-rails) is to use a `packs` directory under the Rails root, so the layout could be in a directory like `#{Rails.root}/packs/pack_name/app/views`
1 parent 89296bf commit 70fc010

File tree

1 file changed

+3
-1
lines changed
  • lib/reactionview/template/handlers

1 file changed

+3
-1
lines changed

lib/reactionview/template/handlers/herb.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ def layout_template?(template)
4040
def local_template?(template)
4141
return true unless template.respond_to?(:identifier) && template.identifier
4242

43-
template.identifier.start_with?("#{Rails.root}/app/views")
43+
ActionController::Base.view_paths
44+
.select { |view_path| view_path.path.start_with?(Rails.root.to_s) }
45+
.any? { |view_path| template.identifier.start_with?(view_path.path) }
4446
end
4547

4648
def active_support_editor

0 commit comments

Comments
 (0)