REST: using a different field than id

Hi,

I have a simple question: When constructing restful urls with something like

edit_user_path @user

I would like the route to be /user/username/edit instead of /user/1/edit

Now, I can do it with edit_user_path(@user.username), but i just don't like it.

Is there a config place that can customize the chosen field?

Thanks,

Roland

Hi,

I have a simple question: When constructing restful urls with
something like

edit_user_path @user

I would like the route to be /user/username/edit instead of /user/1/ edit

Now, I can do it with edit_user_path(@user.username), but i just don't like it.

Does overriding to_param on User to return username do the trick?

Fred

Perfect. Thank you!