Hi How can I access the routes helper
# avo-2
f
Hi! How can I access the routes helper (like my_resource_path(:id)) for a resource outside of avo, in my rails project. Thanks
l
you should use the
avo
engine object
ex:
avo.resources_city_path
f
Thanks, my routes.rb is:
Copy code
namespace :pdf_renderer do
    resources :contracts, only: [:show]
  end
Obvisouly this works:
= link_to 'foo', pdf_renderer_contract_path('47c47920-3da2-4698-a9ea-d79ac3d50e49', format: :pdf), class: 'btn btn-primary'
But this doesn't (from an Avo::BaseAction):
redirect_to avo.resources_pdf_renderer_contract_path(model.id, format: :pdf)
l
ok. so you need to access an external route from inside Avo
I thought it was the other way around
so you'd need to use the
main_app
helper
proabably
main_app.pdf_renderer_contracts_path
I'd suggest you read this part of Rails engines documentation to get acquianted with routing and engines https://guides.rubyonrails.org/engines.html#routes
for reference, Avo is a Rails engine
f
thanks
3 Views