1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Ruby on Rails
Find a file
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
actionmailer Remove duplicated url_for code and move methods shared between ActionMailer and ActionController up to AbstractController. 2010-01-07 15:31:50 +01:00
actionpack From now on, parameters defined in default_url_options can be absent from named routes. 2010-01-07 15:34:14 +01:00
activemodel Allow to specify default attributes names translation in I18n yml files. 2010-01-07 15:31:50 +01:00
activerecord Allow to specify default attributes names translation in I18n yml files. 2010-01-07 15:31:50 +01:00
activeresource Autoload AMo test case 2010-01-04 16:29:07 -06:00
activesupport Remove unneeded reliance on super -> method_missing quirk 2010-01-07 00:06:20 -08:00
arel@0faeb50474 Temporarily add submodules to the Rails repo for Arel and Rack::Mount. These submodules will be removed once we add proper Gemfile following to bundler 2009-11-16 12:30:06 -08:00
ci Update CI bundler 2009-12-21 17:27:30 -06:00
doc/template Horo rdoc template 2008-06-22 10:38:25 -07:00
railties Fix failing app generator test when using the --dev option 2010-01-06 14:22:51 -05:00
tools Rename tools/profile_requires -> tools/profile since we do both require and ruby-prof profiling. 2009-05-27 01:11:33 -05:00
.gitignore Ignore all pkg files 2009-12-02 11:35:48 -08:00
.gitmodules Remove rack submodule, 1.1 has been released as a gem. 2010-01-04 10:09:10 -06:00
Gemfile Errors messages are now moved from :activerecord.errors to simply :errors on I18n yml files. 2010-01-07 15:31:49 +01:00
pushgems.rb
rails.gemspec Break up rails and railties: 2009-12-02 11:35:47 -08:00
Rakefile rake smoke: toplevel task to quickly smoke-test all projects 2009-12-28 12:29:03 -08:00
release.rb Use copy instead of export for release 2008-09-05 14:22:56 +02:00