Skip to content

legacy param behavior breaks router #191

Closed
@catmando

Description

@catmando

Router helpers are breaking if param_accessor_style is legacy.

Problem is router uses params, and param_accessor_style is determined by the application, so the Router needs a consistent way to reference params.

Solution is for the Router to use the alias: feature, to create a instance variable accessor to params.

For example the location router param is aliased to _location_param and the router counts on @_location_param to be initialized regardless of the param_accessor_style.

But currently alias: is being applied to legacy param.xxx style accessors, which then breaks the application code. For example application code historically can use either the location helper method or params.location to get the location value. But if we apply alias to legacy param names then it becomes params._location_param.

So the solution is to NOT honor alias for the legacy param name (only for the instance variable name, and the direct accessor method name.)

Related though is that in the PropsWrapper initializer we don't initialize instance variables if accessor_style is :legacy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions