ohbarye/route_mechanic

If parameter expects not `1`, it fails

Closed this issue · 1 comments

Problem

If there's a path that expects a parameter to be a specific format, it fails.

e.g.

scope ':locale', locale: /en|ja/ do
  get '/locale_test' => 'users#index'
end
  • It expects /en|ja/,
  • But route_mechanic always gives 1 as a parameter in the path.

memo.merge({ required_part => '1' }) # '1' is pseudo id

Solution

I came up with 2 ideas as follow.

  1. Use https://github.com/tom-lord/regexp-examples and generate an example parameter that meets requirements.
  2. Remove assert_routes since it's not the main work of this gem.

I kinda want to choose the 2nd option because assert_* cause some problems like this and #7.


Thank you @pocke for reporting.