xray-rails icon indicating copy to clipboard operation
xray-rails copied to clipboard

ActionView::Template::Error - undefined method `pathname'

Open jmuheim opened this issue 2 years ago • 4 comments

I installed it, but when loading the page, I get:

  Rendered layout layouts/application.html.slim (Duration: 65.6ms | Allocations: 69181)
Completed 500 Internal Server Error in 71ms (ActiveRecord: 4.4ms | Allocations: 73408)

ActionView::Template::Error (undefined method `pathname' for #<#<Class:0x00000001086737a8>:0x0000000108e0ad68 @environment=#<Sprockets::CachedEnvironment:0x7bd4

...

          path = context.pathname.to_s
                        ^^^^^^^^^
Did you mean?  path_to_image):
  
xray-rails (0.3.2) lib/xray/engine.rb:58:in `run'

jmuheim avatar Sep 28 '22 15:09 jmuheim

Unfortunately, I think this gem is not fully compatible with sprockets 4.x You can try the master branch to see if that works for your app (the pathname issue was addressed in #103 but was never released). Or you can pin your sprockets dependency in your Gemfile to ~> 3.5, which might work, too.

This gem will probably need to be rewritten (or perhaps reimagined as an npm module) to support the new generation of frontend tools commonly used with Rails, like esbuild, propshaft, webpack, etc. For now, it is pretty much stuck in limbo.

mattbrictson avatar Sep 29 '22 01:09 mattbrictson

Thanks for explaining this. 🙏

jmuheim avatar Sep 29 '22 08:09 jmuheim

I tried master, and I also locked sprockets to ~> 3.5, but in both cases I receive:

ActionView::Template::Error (undefined method `safe_concat' for {:add_to_stack=>true}:Hash

            @virtual_path = "shared/_breadcrumbs";items = local_assigns[:items]; items = items;;@output_buffer = output_buffer || ActiveSupport::SafeBuffer.new; @output_buffer.safe_concat(("<nav aria-label=\"You are here\" id=\"breadcrumbs\"><ol>".freeze));

Sad, sad, sad. I loved xray-rails for many years and was so used to hit Cmd+Shift+X... Anyone knows an alternative? I tried rails-footnotes, but doesn't seem to work either.

jmuheim avatar Oct 01 '22 11:10 jmuheim

Working on rails 6 & 7 with sprockets 4.1

https://github.com/brentd/xray-rails/issues/119

deepakmahakale avatar Dec 27 '22 10:12 deepakmahakale