1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add RoutingError exception when RouteSet fails to generate a path from a Named Route. [Rick Olson]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4733 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Rick Olson 2006-08-09 00:02:08 +00:00
parent e9b0284070
commit 4679e1bf7f
2 changed files with 9 additions and 7 deletions

View file

@ -1,16 +1,15 @@
*SVN*
<<<<<<< .mine
* Add RoutingError exception when RouteSet fails to generate a path from a Named Route. [Rick Olson]
* Replace Reloadable with Reloadable::Deprecated. [Nicholas Seckar]
=======
* Deprecation: check whether instance variables have been monkeyed with before assigning them to deprecation proxies. Raises a RuntimeError if so. [Jeremy Kemper]
* Add support for the param_name parameter to the auto_complete_field helper. #5026 [david.a.williams@gmail.com]
* Deprecation! @params, @session, @flash will be removed after 1.2. Use the corresponding instance methods instead. You'll get printed warnings during tests and logged warnings in dev mode when you access either instance variable directly. [Jeremy Kemper]
>>>>>>> .r4727
* Make Routing noisy when an anchor regexp is assigned to a segment. #5674 [francois.beausoleil@gmail.com]
* Added months and years to the resolution of DateHelper#distance_of_time_in_words, such that "60 days ago" becomes "2 months ago" #5611 [pjhyett@gmail.com]

View file

@ -981,9 +981,10 @@ module ActionController
end
def generate(options, recall = {}, method=:generate)
if options[:use_route]
named_route_name = options.delete(:use_route)
if named_route_name
options = options.dup
named_route = named_routes[options.delete(:use_route)]
named_route = named_routes[named_route_name]
options = named_route.parameter_shell.merge(options)
end
@ -1006,7 +1007,9 @@ module ActionController
merged = recall.merge(options)
if named_route
return named_route.generate(options, merged, expire_on)
path = named_route.generate(options, merged, expire_on)
raise RoutingError, "#{named_route_name}_url failed to generate from #{options.inspect}, missing: #{(named_route.significant_keys - options.keys).inspect}" if path.nil?
return path
else
merged[:action] ||= 'index'
options[:action] ||= 'index'
@ -1014,7 +1017,7 @@ module ActionController
controller = merged[:controller]
action = merged[:action]
raise "Need controller and action!" unless controller && action
raise RoutingError, "Need controller and action!" unless controller && action
# don't use the recalled keys when determining which routes to check
routes = routes_by_controller[controller][action][options.keys.sort_by { |x| x.object_id }]