Sha256: dfc67beb3704be2f35ce5e13eb2f269c678b503155f1aa387521f779fc7620f5
Contents?: true
Size: 813 Bytes
Versions: 18
Compression:
Stored size: 813 Bytes
Contents
# frozen_string_literal: true module Renalware class ApplicationComponent < ViewComponent::Base include Renalware::Engine.routes.url_helpers include Pundit::Helper delegate :current_user, :policy, to: :helpers # Not sure why include Renalware::Engine.routes.url_helpers does not make the # engine urls visible in the views (seems to resolve alwatys to /assets?..) # so we expose routes here so inside a component html file we can use # e.g. renalware.bookmarks_path def renalware Renalware::Engine.routes.url_helpers end # Added this helper as I can't seem to get the Pundit #policy helper to be included # in the context when rendering a component template. def policy(record) current_user && Pundit.policy(current_user, record) end end end
Version data entries
18 entries across 18 versions & 1 rubygems