I have a route in my code that looks like this:
map.app 'applications/:title_header', :controller => 'apps', :action => 'show'
I also changed my show method in the controller to be like this:
@app = App.find_by_title_header(params[:title_header])
If I type in applications/title
things work fine. If I type in applications/1
(valid Id) it fails (as expected)
However when I'm trying to use the friendly url helpers, in this case app_path(@app)
the URLs that are generated look like applications/1
. The only way I can get it to work is by putting in app_path(@app.title_header)
. It seems like if it "just knows" that the ID is what's being passed out of the app object that it should "just know" that it should by default pass the name instead now. What do I need to change?