1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/lib
José Valim f149eb19d4 From now on, parameters defined in default_url_options can be absent from named routes.
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.
2010-01-07 15:34:14 +01:00
..
abstract_controller Remove duplicated url_for code and move methods shared between ActionMailer and ActionController up to AbstractController. 2010-01-07 15:31:50 +01:00
action_controller Remove duplicated url_for code and move methods shared between ActionMailer and ActionController up to AbstractController. 2010-01-07 15:31:50 +01:00
action_dispatch From now on, parameters defined in default_url_options can be absent from named routes. 2010-01-07 15:34:14 +01:00
action_pack Bump up the version to 3.0.pre 2009-06-30 14:37:12 -07:00
action_view From now on, parameters defined in default_url_options can be absent from named routes. 2010-01-07 15:34:14 +01:00
abstract_controller.rb Remove duplicated url_for code and move methods shared between ActionMailer and ActionController up to AbstractController. 2010-01-07 15:31:50 +01:00
action_controller.rb Remove duplicated url_for code and move methods shared between ActionMailer and ActionController up to AbstractController. 2010-01-07 15:31:50 +01:00
action_dispatch.rb Trash string coercion rack hacks 2010-01-04 19:46:21 -06:00
action_pack.rb Bump up the year in MIT license files 2009-01-18 05:28:21 +00:00
action_view.rb Autoload AC and AV test case classes 2010-01-04 16:22:46 -06:00