55
42

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Railsのcontroller, view内でURLを取得する

Last updated at Posted at 2012-12-26
root_url(only_path: false) #=> http://localhost:3000/
request.host_with_port #=> localhost:3000
request.fullpath #=> /posts/index
url_for(only_path: false) #=> http://localhost:3000/posts/index

追記:Rails5での動作を確認しました。(より良い方法があるかどうかは未確認)

55
42
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
55
42

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?