Class: Renalware::ApplicationComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
Pundit::Helper
Defined in:
app/components/renalware/application_component.rb

Instance Method Summary collapse

Instance Method Details

#policy(record) ⇒ Object

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.



19
20
21
# File 'app/components/renalware/application_component.rb', line 19

def policy(record)
  current_user && Pundit.policy(current_user, record)
end

#renalwareObject

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



13
14
15
# File 'app/components/renalware/application_component.rb', line 13

def renalware
  Renalware::Engine.routes.url_helpers
end