1. 11 1月, 2010 5 次提交
  2. 10 1月, 2010 3 次提交
  3. 09 1月, 2010 13 次提交
  4. 08 1月, 2010 18 次提交
  5. 07 1月, 2010 1 次提交
    • J
      From now on, parameters defined in default_url_options can be absent from named routes. · f149eb19
      José Valim 提交于
      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.
      f149eb19