Converted RatesController#index to require a user_id parameter

* This action will turn into the Rate History screen

  #1916
This commit is contained in:
Eric Davis
2009-01-19 10:25:04 -08:00
parent 441a86e7a6
commit a2e77e8182
3 changed files with 48 additions and 8 deletions
+14 -4
View File
@@ -2,11 +2,21 @@ class RatesController < ApplicationController
# GET /rates
# GET /rates.xml
def index
@rates = Rate.find(:all)
begin
@user = User.find(params[:user_id])
@rates = Rate.history_for_user(@user)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @rates }
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @rates }
end
rescue ActiveRecord::RecordNotFound
respond_to do |format|
flash[:error] = l(:rate_error_user_not_found)
format.html { redirect_to(home_url) }
format.xml { render :xml => "User not found", :status => :not_found }
end
end
end