elixir-cldr / cldr_routes

Localised routes and path helpers for Phoenix applications
Other
14 stars 6 forks source link

Phx 1.7-dev: Phoenix.Router.Route.exprs/1 is undefined or private #10

Closed rubas closed 1 year ago

rubas commented 1 year ago

routes_with_exprs = Enum.map(routes, &{&1, Phoenix.Router.Route.exprs(&1)})

This line changed in Phoenix.

https://github.com/phoenixframework/phoenix/blob/b3592c38a93bbb61dbf29d1c11245f350500797c/lib/phoenix/router.ex#L493

BartOtten commented 1 year ago

This should be helpful (consider aliasing Phoenix.Router.Route). Using apply silences the warning.

def exprs(route, env) do
    if Kernel.function_exported?(Phoenix.Router.Route, :exprs, 2) do
      forwards = env.module |> Module.get_attribute(:phoenix_forwards)
      apply(Phoenix.Router.Route, :exprs, [route, forwards])
    else
      apply(Phoenix.Router.Route, :exprs, [route])
    end
  end
kipcole9 commented 1 year ago

@BartOtten thanks very much. I know I am way behind in getting this lib up-to-date. This will definitely help.

kipcole9 commented 1 year ago

Ah, turns out I'd already made that change. I've done all the hard work on verified routes too - except the actual path translation which I just haven't prioritised. I will get this finished up in the next few days.

ry-TU commented 1 year ago

@kipcole9 first of all thanks for your hard work generally for cldr, given Phoenix 1.7 is already out is there any chance we can publish a release to get the fix? Is there anything missing or we can help with to get this released?