Created
August 21, 2012 17:03
-
-
Save anonymous/3417328 to your computer and use it in GitHub Desktop.
This file contains 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 RawDataController < ApplicationController | |
helper_method :sort_column, :sort_direction | |
def index | |
end | |
protected | |
def sort_column | |
logger.debug @sort_model.inspect | |
@sort_model.column_names.include?(params[:sort]) ? params[:sort] : @sort_default_col | |
end | |
def sort_direction | |
%w[asc desc].include?(params[:direction]) ? params[:direction] : "asc" | |
end | |
end | |
class DevicesController < RawDataController | |
@sort_model = Device | |
@sort_default_col = 'blah' | |
def index | |
logger.debug @sort_model.inspect | |
@devices = Device.search(params[:search]).order(sort_column + " " + sort_direction).paginate(:per_page => 40, :page => params[:page]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment