How do I get the current absolute URL in Ruby on Rails?

后端 未结 30 2497
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-22 13:47

How can I get the current absolute URL in my Ruby on Rails view?

The request.request_uri only returns the relative URL

30条回答
  •  独厮守ぢ
    2020-11-22 14:14

    if you want to be specific, meaning, you know the path you need:

    link_to current_path(@resource, :only_path => false), current_path(@resource)
    

提交回复
热议问题