【问题标题】:Custom Route issue in Phoenix凤凰城的自定义路线问题
【发布时间】:2017-11-09 02:27:41
【问题描述】:

这是我的路线

scope "/api/v1", Web do
    pipe_through :api

    resources "/assets", AssetController do
      get "/descendants", AssetController, :descendants, as: :descendants
    end  
end

当我这样做时:

iex(1)> import Web.Router.Helpers
Web.Router.Helpers
iex(2)> alias Web.Endpoint
Web.Endpoint
iex(3)> asset_path(Endpoint, :index)
"/api/v1/assets"
iex(4)> asset_descendants_path(Endpoint, :descendants)
** (CompileError) iex:4: undefined function asset_descendants_path/2

asset_descendants_path(Endpoint, :descendants) 有错误

这里是> mix routes

asset_descendants_path  GET     /api/v1/assets/:asset_id/descendants  Web.AssetController :descendants

【问题讨论】:

    标签: routes elixir phoenix-framework


    【解决方案1】:

    您似乎缺少asset_id。你需要把它传递进去。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-05-03
      • 2016-09-09
      • 1970-01-01
      • 1970-01-01
      • 2017-07-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多