mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Ruby on Rails
f149eb19d4
This allows the following setup to work: # app/controllers/application_controller.rb class ApplicationController def default_url_options(options=nil) { :locale => I18n.locale } end end # From your views and controllers: I18n.locale #=> :en users_url #=> "/en/users" users_url(:pl) #=> "/pl/users" user_url(1) #=> "/en/users/1" user_url(:pl, 1) #=> "/pl/users/1" user_url(1, :locale => :pl) #=> "/pl/users/1" If you provide all expected parameters, it still works as previously. But if any parameter is missing, it tries to assign all possible ones with the hash returned in default_url_options or the one passed straight to the named route method. Beware that default_url_options in ApplicationController is not shared with ActionMailer, so you are required to always give the locale in your email views. |
||
---|---|---|
actionmailer | ||
actionpack | ||
activemodel | ||
activerecord | ||
activeresource | ||
activesupport | ||
arel@0faeb50474 | ||
ci | ||
doc/template | ||
railties | ||
tools | ||
.gitignore | ||
.gitmodules | ||
Gemfile | ||
pushgems.rb | ||
rails.gemspec | ||
Rakefile | ||
release.rb |