Notes posted by misbehavens

RSS feed
May 30, 2013
0 thanks

Avoiding to_param method when using URL helper methods

I recently found myself in the situation where I needed to generate URLs which included the ID instead of the value returned from the model’s to_param method (since someone had overridden the to_param method). It turned out to be easier than I thought. You can simply pass an ID to the helper method and it will construct the URL correctly:

# /admin/foobars/123/edit