# ==== Relying on named routes
#
# If you instead of a hash pass a record (like an Active Record or Active Resource) as the options parameter,
# you'll trigger the named route for that record. The lookup will happen on the name of the class. So passing
# a Workshop object will attempt to use the workshop_path route. If you have a nested route, such as
# admin_workshop_path you'll have to call that explicitly (it's impossible for url_for to guess that route).
#
有这样一个路由:
map.show_forums_topic '/forums/:forum_id/topics/:topic_id/', :controller=>'topic', :action=>'show'
我们就可以用来映射到些地址:
redirect_to show_forums_topic(@forums,@topic)
或者编辑:redirect_to edit_forums_topic(@forums,@topic)
rails route
最新推荐文章于 2023-05-23 10:02:45 发布