[openstreetmap/openstreetmap-website] Simplify user links (#1785)
notifications at github.com
Wed Mar 14 06:49:52 UTC 2018
Currently our views are full of very verbose links to users, for example:
> link_to contact.display_name, :controller => 'user', :action => 'view', :display_name => contact.display_name
This can be simplified by using the "user_path" method, to something like
> link_to contact.display_name, user_path(contact.display_name)
Normally this could be made even easier, since rails does the right thing with `model_path(model)` by default. However, since we use the `display_name` in the url rather than the `id`, we first need to define `to_param` on the User model:
This then allows the links to be even more straightforward, namely:
> link_to contact.display_name, user_path(contact)
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rails-dev