Polymorphic Routes

1 · Ryan Bigg · Dec. 12, 2018, 1 p.m.
Really early on in Rails, you would write routes like this: redirect_to :controller => "posts", :action => "show", :id => @post.id What this would do is dutifully redirect to the show action inside the PostsController and pass along the id parameter with a value of whatever @post.id returns. Typical 302 response. Then Rails 1.2 came along and allowed you to use routing helpers, like this: redirect_to post_path(@post) And the people rejoiced. This would do effectively the same thing. post_path ...