Topic: Nested Routes in Controller - please comment my code
I have two models in my application: User has_many Results.
I want the the URL /results/ to return all Results, and the URL /users/MrSmith/results/ to return just the Results for User "MrSmith".
This is what my code looks now:
class ResultsController < ApplicationController
@user = User.find_by_login(params[:user_id])
@results = Result.find(:all)
@results = @user.results
This works, but can it be improved?