Displaying 2 results from an estimated 2 matches for "switch_language".
2008 Jan 03
3
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...
2010 Jul 08
1
[Rails3] Issue in modifying locale and redisplaying page
...rget.id + " option:selected");
var value = selected.val();
$.ajax({
data: ''locale=''+ value,
type: ''post'',
url: ''/locale''
});
});
});
routes.rb
match ''/locale'' => "welcome#switch_language"
welcome_controller.rb
..
def switch_language
I18n.locale = params[:locale].to_sym
redirect_to root_url
end
what could be wrong ?
thanks fyh
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this grou...