Skip to content

Instantly share code, notes, and snippets.

@svs
Created December 16, 2012 21:01
Show Gist options
  • Save svs/4312999 to your computer and use it in GitHub Desktop.
Save svs/4312999 to your computer and use it in GitHub Desktop.
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