I have to edit a received URL, but in some cases the URL may contain an external reference with http
and this breaks my system because it only accepted paths to the platform itself.
Here is a snippet of code and some output:
<%-object.each do |o| -%>
<%- url = @context.nil? ? polymorphic_path([ :adm, o]) : polymorphic_path([ :adm, @context, o])-%>
Some outputs:
<%= o -%> = #<Collection:0x7f068b067870>
<%= @context.nil? -%> = true
<%= polymorphic_path([ :adm, o]) -%> = /admin/pagina/biblioteca
Here is my error, sometimes this link may be external, and when concatenate I can not make it work:
<%= polymorphic_path([ :adm, o]) -%> = /admin/pagina/https://livraria.com
I believe that this return of the variable url
is a String.