跳至內容 跳至搜尋

URL For

在主機類別中加入 url_for(例如摘要控制器或郵件發送器)。該類別必須透過實作 _routes 方法提供 RouteSet。否則,系統會產生例外狀況。

請注意,這個模組完全脫離 HTTP - 唯一的需求是有效的 _routes 實作。

命名空間
方法
#
已包含模組

執行個體公用方法

_routes()

# File actionpack/lib/abstract_controller/url_for.rb, line 18
def _routes
  raise "In order to use #url_for, you must include routing helpers explicitly. " \
        "For instance, `include Rails.application.routes.url_helpers`."
end