Skip to content

Support for view_component #112

@zealot128

Description

@zealot128

view component is a library used by Github which grows in popularity for replacing partials.
I made a Proof of concept by patching into ViewComponent render method:

# config/initializers/xray_view_component.rb

if defined? Xray
  module XRayPatch
    def render_in(*args)
      result = super
      path = self.class.source_location         
      Xray.augment_template(result, path)
    end    
  end

  ViewComponent::Base.prepend(XRayPatch)                                                                                                                                                                            end

It then uses the Ruby object's name as template address. One could optimize the path extraction, but maybe someone else want's to pick up the POC and work this into this library.

Bildschirmfoto 2021-04-27 um 10 14 16

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions