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
José Valim
f564f947d9
Remove duplicated url_for code and move methods shared between ActionMailer and ActionController up to AbstractController.
2010-01-07 15:31:50 +01:00
José Valim
c68cc49dcd
Use helpers.label instead of views.labels.
2010-01-07 15:31:50 +01:00
José Valim
a091e2e4f6
errors in ActionView should not be namespaced as well.
2010-01-07 15:31:50 +01:00
José Valim
0d5ce7c525
namespace in routes changes both the path and name prefix.
2010-01-06 09:51:46 +01:00
José Valim
e55d70a380
redirect in routes takes port into account [ #3653 status:resolved]
2010-01-05 23:40:56 +01:00
Joshua Peek
b3900a29eb
All router redirect helper to accept a full URI [ #3653 state:resolved]
2010-01-05 12:00:38 -06:00
Joshua Peek
3f28e0bda6
Trash string coercion rack hacks
2010-01-04 19:46:21 -06:00
Joshua Peek
e5ed62deea
Autoload AR test case
2010-01-04 16:50:01 -06:00
Joshua Peek
2601a16ede
Autoload AS test case
2010-01-04 16:22:46 -06:00
Joshua Peek
cf83a6f16b
Autoload AC and AV test case classes
2010-01-04 16:22:46 -06:00
José Valim
bd729344a7
Remove deprecated formatted named routes
2010-01-04 23:05:27 +01:00
Zach Brock
79438b4638
adding fix for auto linking to master too
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-01-05 10:57:20 +13:00
José Valim
f2d276fefd
Ensure no notification is on the queue before running notifications related tests.
2010-01-03 23:39:09 +01:00
José Valim
53c6984944
Add notifications to ActionDispatch::ShowExceptions, this can be used as hooks for plugins like ExceptionNotifier.
2010-01-03 23:33:34 +01:00
José Valim
6fbe9ef2ff
Use namespaces in notifications.
2010-01-03 20:39:42 +01:00
Carsten Gehling
bef968d379
I18n label helper [ #745 status:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-02 22:27:02 +01:00
Jeremy Kemper
db49b7dc94
Fix new year heisenbug
2009-12-31 18:32:16 -08:00
Jeremy Kemper
c4c2502df8
Fix controller runtime test
2009-12-30 22:15:02 -08:00
José Valim
4ecdf24bde
Kick AR logging back to life and move ControllerRuntime inside ActiveRecord::Rails.
2009-12-30 13:07:48 +01:00
Yehuda Katz
12e43494a7
Merge remote branch 'jose/perf'
2009-12-27 14:36:59 -08:00
David Heinemeier Hansson
95762cbbb3
Added shorthand for match 'products/overview' that expands to match 'products/overview', :to => 'products#overview', :as => 'products_overview'
2009-12-27 14:13:03 -08:00
José Valim
75ba102a80
Remove ActionView inline logging to ActiveSupport::Notifications and create ActionController::Base#log_event, so everything can be logged within one listener. Also expose log_process_action as a hook for different modules to include their own information during the action processing. This allow ActiveRecord to hook and any other ORM. Finally, this commit changes 'Processing' and 'Rendering' in logs to 'Processed' and 'Rendered' because at the point it's logged, everying already happened.
2009-12-26 20:28:53 +01:00
Joshua Peek
f53c36350d
Expect Rack 1.1
2009-12-26 13:25:35 -06:00
David Heinemeier Hansson
a8f1ee5986
Fix tests
2009-12-25 10:04:26 -08:00
David Heinemeier Hansson
38af368360
Merge
2009-12-24 15:24:57 -08:00
David Heinemeier Hansson
2b7256a42e
Extract Mapping class from monster match method
2009-12-24 15:23:39 -08:00
Sam Ruby
aa3565f3a6
Allow named_routes to be used with root, and with new DSL short-form.
...
The real use case it to make all of the following act the same:
root 'store#index', :as => 'store'
match '/' => 'store#index', :as => 'store'
match '/', :to => 'store#index', :as => 'store'
The test case provided deviates from this in order to demonstrate all three
forms in a single set of test routes.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-12-23 20:55:21 -08:00
Jeremy Kemper
4d3602a8c4
Routing: fix that route shorthand shouldn't ignore other options. Raise if :as option is given to root method since its name is always 'root'
2009-12-23 17:42:30 -08:00
Jeremy Kemper
24e1b55608
Fix bare string Rack response bodies
2009-12-23 13:06:53 -08:00
Joshua Peek
a1bf2f96ce
AD::StatusCodes support is now part of rack
2009-12-22 16:08:03 -06:00
David Heinemeier Hansson
8e48a5ef0c
Add test for root
2009-12-21 21:49:36 -08:00
David Heinemeier Hansson
fee07b9da0
Merge branch 'master' of github.com:rails/rails
2009-12-21 15:50:19 -08:00
Joshua Peek
f82e1046f8
reset_session needs to be a real method so flash can override it
2009-12-21 17:29:59 -06:00
David Heinemeier Hansson
fa8849a573
Merge branch 'master' of github.com:rails/rails
2009-12-21 11:28:16 -08:00
David Heinemeier Hansson
3ff9e9ee14
Its now possible to use match 'stuff' => 'what#stuff' instead of using the :to for simple routes
2009-12-20 20:37:36 -08:00
David Heinemeier Hansson
83f4d86a93
Rename the RenderingController module to just plain Rendering
2009-12-20 17:15:31 -08:00
David Heinemeier Hansson
c06aff0a7e
Added cookies.permanent, cookies.signed, and cookies.permanent.signed accessor for common cookie actions [DHH]
2009-12-20 14:33:13 -08:00
Yehuda Katz
e48b4c2dd0
:to => redirect() can take a String using 1.9-style interpolation or proc that takes the path parameters as a Hash
2009-12-20 14:07:32 -08:00
Joshua Peek
2419fae092
Pending tests for AD Response
2009-12-17 22:10:37 -06:00
Joshua Peek
3b44f35e24
Don't need response prepare!
2009-12-17 22:10:37 -06:00
David Heinemeier Hansson
fa575973b1
Added alert/notice from 2-3-stable and refactored redirect_to into just living in Redirector [DHH]
2009-12-17 16:37:11 -08:00
Joshua Peek
7ee5843c3c
Fully expand relative rails framework paths and make sure we aren't
...
adding any to the load path more than once.
2009-12-16 11:56:51 -06:00
Joshua Peek
5f8e48cbd2
Move route reloading into railties
2009-12-14 17:54:41 -06:00
Joshua Peek
ce970a8bb9
Remove route loading tests since it should be tested by railties
2009-12-14 16:52:22 -06:00
Joshua Peek
bcb686054a
Hush loading AR unless it fails
2009-12-14 16:01:23 -06:00
Joshua Peek
ee395fe626
TestProcess belongs in AD
2009-12-12 18:09:44 -06:00
Joshua Peek
2297eaed5b
"new" and "edit" name routes always need to be prepend to the
...
named_route [#3561 state:resolved]
2009-12-11 12:46:50 -06:00
Joshua Peek
588225f885
Remove fancy method not allowed resource exceptions since they are
...
too much of a hack
2009-12-11 00:01:22 -06:00
Joshua Peek
2f90d70049
Kill RouteSet#recognize
2009-12-10 23:45:04 -06:00