enriclluelles/route_translator

Routing parameter at the front

kkak10 opened this issue · 3 comments

When my routes config has:

Rails.application.routes.draw do
  localized do
    match '/:val/test' => 'test#index', :via => :get
  end
end

controller:

def index
  param_val = params[:val]
  ...
end

I would like to receive a param_val as 'hihi' when requested by /en/hihi/test

but param_val is 'en'.

How can we fix it?

Hi,

sorry for the late reply

Does

Rails.application.routes.draw do
  scope(':locale') do
    localized do
      match '/:val/test' => 'test#index', :via => :get
    end
  end
end

work for your use case?

@tagliala Thanks for the reply. I'll try

Closing here, feel free to comment if it does not solve your issue