How to use "link_to" to deliver a parameter?

Hello, there:
I wish A link to invoke such a action together with the parameter
“zh_CN” “cookies/switch_language/zh_CH” to switch language
sellection, and I use the following code:
<%= link_to ‘Chinese’, :controller => ‘cookies’, :action =>
‘switch_lang’ %>

But, how is “link_to” able to convey the params: zh_CN as well?
seems like link_to doesn’t support a option :params =>
‘zh_CN’…because it errors when I use
'<%= link_to ‘Chinese’, :controller => ‘cookies’, :action =>
‘switch_lang/zh_CN’ %> &
<%= link_to ‘Chinese’, :controller => ‘cookies’, :action =>
‘switch_lang’, params: => 'zh_CN ’ %>

Thanks in advance!
Myst

'<%= link_to ‘Chinese’, :controller => ‘cookies’, :action =>
‘switch_lang/zh_CN’ %> &
<%= link_to ‘Chinese’, :controller => ‘cookies’, :action =>
‘switch_lang’, params: => 'zh_CN ’ %>

Assuming you still have the default route installed use this:

<%= link_to ‘Chinese’, :controller => ‘cookies’,
:action => ‘switch_lang’,
:id => ‘zh_CN’ %>

You could also use a custom route so you can use the symbol of your
choosing and assemble the URL however you want. Something like…

<%= link_to ‘Chinese’, :controller => ‘cookies’,
:action => ‘switch_lang’,
:lang => ‘zh_CN’ %>

…and…

map.connect ‘foo/:lang’, :controller => ‘cookies’, :action =>
‘switch_lang’

Preston


PrestonLee.com
OpenRain, LLC

Cool, thank you both!