Created
March 3, 2017 01:05
-
-
Save basmoura/4a3ee2606a7f1f0b063b3ccac6b004d6 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
def index | |
@cursos = Curso.all | |
if request.format =="application/json" | |
where = " ativo='S' and escritorio_id= "+params[:escritorio_id].to_s | |
else | |
where = " escritorio_id= "+current_user.escritorio_id.to_s | |
end | |
if params[:titulo] != nil && params[:titulo].length>0 | |
where+=" and titulo like '%"+params[:titulo]+"%' " | |
end | |
if params[:ativo] != nil && params[:ativo].length>0 | |
where+=" and ativo = '"+params[:ativo]+"' " | |
end | |
@cursos = @cursos.paginate(:page => params[:page], :per_page => 10).order('titulo ASC').where(where) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment