I have a Posts model with id and title columns.
I've got my route (rails 2.3.8) set up as follows:
map.post ':title/:id', :controller => 'posts', :action => 'show'
which works correctly when recognising URLs and when generating them explicitly, as in
post_url(:title => 'foo', :id => 123)
which comes out nicely as /foo/123. What I'd like is to be able to call
p = Post.create!(:title => 'foo') # let's assume it gets ID 123
url_for(p)
and get the same path out. But I get an error:
post_url failed to generate from {:action=>"show", :controller=>"posts",
:title=>#<Post id: 123 title: "foo" created_at: ...
How do I specify that a named route should use a model's columns its _url and _path functions?