Using record variable in routes

# routes.rb
map.connect "/projects/:project_slug/:image_slug", :controller =>
"images", :action => "show"

# images_controller.rb
def show
  @project = Project.find_by_slug(params[:project_slug])
  @image = Image.find_by_slug(params[:image_slug])
  ...
end