Created
August 31, 2010 14:31
-
-
Save anonymous/559106 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
params[:page] ||= 1 | |
params[:order] ||= 'date' | |
conditions = [""] | |
if !params[:date_since].nil? and !params[:date_since].empty? | |
conditions[0] += "? < date AND " | |
conditions += [params[:date_since]] | |
end | |
if !params[:date_until].nil? and !params[:date_until].empty? | |
conditions[0] += "? < date AND " | |
conditions += [params[:date_until]] | |
end | |
if !params[:name].nil? and !params[:name].empty? | |
conditions[0] += "employees.name LIKE ? AND " | |
conditions += [params[:name]] | |
end | |
if !params[:serial_number].nil? and !params[:serial_number].empty? | |
conditions[0] += "cards.serial_number = ? AND " | |
conditions += [params[:serial_number]] | |
end | |
conditions[0] += "TRUE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment