How to automatically set params based on passed object when generating a route?


having i.e. a post model that has many categories - is it possible for
member routes like i.e. post_path(post) to generate path like "/
posts/:post_category_name/:post_id" without manually passing the
category param? Does anyone know if there's a gem or if I can simply
override the post_url method to automatically set category from post

The best I could get right now is post_path(post.category, post), but
while it doesn't look awful it still breaks all links in my app where
most of the time I generate links using link_to(post.title, post).