Created
December 16, 2012 21:01
-
-
Save svs/4312999 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class QuotationsController < ApplicationController | |
def index | |
@params = QuotationsIndexParams.new(params) | |
(redirect_to request.referer || quotations_path, :error => "Bad Request", :status => 400 and return) unless @params.valid? | |
@quotations = Quotation.search(@params.search_params). | |
send(@params.scope, @params.scope_params). | |
sorted_by(@params.sort.to_sym). | |
page(params[:page]) | |
respond_to do |format| | |
format.html # index.html.erb | |
format.json { render json: @quotations } | |
format.csv | |
end | |
end | |
... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment