I\'m trying to achieve URLs like this in Rails:
http://localhost/posts/1234/post-slug-name
with both ID and slug name instead of either
You'll want to add a regular route with Route Globbing in addition to your resource route (assuming of course that's how your posts routes are defined). For example,
posts
map.resources :posts map.connect '/posts/:id/*slugs', :controller => 'posts', :action => 'show'