Can this be simplified even further

Just a thought, that this can be simplified by guessing the namespace of the controller or the params[:controller]

class Admin::Users < ApplicationController end

params[:controller]=>'admin/users'

Most use cases fall with in this context, don't they?

Excuse me, if I come across as a complete idiot, this is the first time am looking at the edge, resources and url helpers. Certainly, I felt the pain while trying to pass [:admin, @user] for so many url helpers.

Thanks.

So, you want to be able to call url_for(@user) and that Rails guesses that it is in the :admin namespace because the current controller is “admin/users”. I felt this pain of context insensitivity too, but if you have User resource outside of admin namespace, how would you refer to it then?

Referring it outside the context makes sense to add [:admin, @user] which is intuitive. While coding that we realise we are outside the context. Also guessing instead of fixing it in the code, helps in moving the controller to a different name space easier.

may be it can be url_for (@user, :in=>:admin)