`
xu_wccq
  • 浏览: 130869 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

rails route

    博客分类:
  • ruby
阅读更多
      # ==== 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)
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics