Displaying 1 result from an estimated 1 matches for "load_user".
Did you mean:
ldap_user
2008 Dec 08
0
Complex polymorphic routes
.../comments
where the comments controller handles different parent types.
I have often used something more like this:
/users/1/domains
/domains
Each of these are "scoped" such that if a params[:user_id] is present,
it will scope the domains list, via something like:
def index
load_user
if @user
@domains = @user.domains
else
@domains = Domains.find :all
end
end
private
def load_user
if params[:user_id]
@user = User.find params[:user_id]
end
end
This technique works well for me, even if not QUITE so DRY as I would
like. However, whe...