Created
November 5, 2010 18:12
-
-
Save dennermiranda/664545 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 GradesController < ApplicationController | |
#load_and_authorize_resource | |
before_filter :authenticate_user! | |
def aluno | |
@aluno =Aluno.find(current_user.associable_id) | |
@pessoa = Pessoa.find(@aluno.pessoa_id) | |
@aluno_diario = AlunoDiario.where(:aluno_id => @aluno.id).to_a | |
@diario = [] | |
# @aluno_diario = AlunoDiario.all(:joins => 'SELECT * FROM aluno_diarios diarios LEFT OUTER JOIN disciplinas ON disciplinas.id = diarios.disciplina_id WHERE diarios.id = aluno_diarios.diario_id and aluno_id = 2') | |
@aluno_diario.each{|alunod| | |
@diario << Diario.where(:id => alunod.diario_id).first | |
} | |
@disciplina = [] | |
@diario.each { |diario| | |
@disciplina << Disciplina.where(:id => diario.disciplina_id).first | |
} | |
@curso = Curso.find(@diario.first.curso_id) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment