brentd / xray-rails

☠️ A development tool that reveals your UI's bones
MIT License
1.22k stars 79 forks source link

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

Open jmuheim opened 1 year ago

jmuheim commented 1 year ago

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'
mattbrictson commented 1 year ago

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.

jmuheim commented 1 year ago

Thanks for explaining this. 🙏

jmuheim commented 1 year ago

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.

deepakmahakale commented 1 year ago

Working on rails 6 & 7 with sprockets 4.1

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