[openstreetmap/openstreetmap-website] Use resourceful routes for granting/revoking user roles (PR #5293)

Anton Khorev notifications at github.com
Wed Nov 6 15:44:18 UTC 2024


@AntonKhorev commented on this pull request.



> +  def update
     @user.roles.create(:role => @role, :granter => current_user)

The routing system requires some convincing to achieve that. The less ugly version I could come up with is singular resources for roles, despite there are multiple possible roles for each user:

    resource :role, :controller => "user_roles", :path => "roles/:role", :only => [:create, :destroy]

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5293#discussion_r1831270674
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5293/review/2418704782 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20241106/d692850e/attachment.htm>


More information about the rails-dev mailing list