Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Relative to absolute url in rails

In my view i have link like following

<%= link_to raw(truncate(strip_tags(record.sch.first.to_s + ': ' + record.name), :length => 120, :omission => "...")), (Figaro.env.base_url + record.named_url) %>

But as result this produces me link like

basedomain.com/(Figaro.env.base_url)/record.named_url

when i want it to be

(Figaro.env.base_url)/record.named_url

How do i make this like absolute, not relative?

like image 753
Avdept Avatar asked Oct 16 '25 17:10

Avdept


1 Answers

Add only_path: false at the end:

<%= link_to raw(truncate(strip_tags(record.sch.first.to_s + ': ' + record.name), :length => 120, :omission => "...")), (Figaro.env.base_url + record.named_url), only_path: false %>
like image 194
zishe Avatar answered Oct 19 '25 11:10

zishe