I was able to solve it this way...
In my view
<% @students.each do |student| %>
<tr>
<td><%= student['nome'] %></td>
<td><%= student['matricula'] %></td>
<td><%= student['sala'] %></td>
<td><%= student['status']%></td>
<td><%= link_to 'Edit', edit_student_path(student['id']) %></td>
<td><%= link_to 'Destroy', student_path(student['id']), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
In my Model
def ajustaDadosAluno
queryRoom = "select s.id AS id,s.name AS nome, s.registration AS matricula,
r.description AS sala, si.descricao AS status FROM students s
INNER JOIN rooms r ON r.id = s.room_id
INNER JOIN situations si ON s.room_id = si.id"
retorno= ActiveRecord::Base.connection.execute(queryRoom)
end
On my controller
def index
#@students = Student.all
#render :json => @students
student = Student.new
@students = student.ajustaDadosAluno
end
Your question is not very clear. It is more clearly exemplified what is happening and how you want it to look. Using examples becomes clearer.
– Luiz Carvalho
Ah you’re the guy who and does not mark answers as certain review your previous questions dude. Mark these answers as accepts help who answered and who is seeking the solution as you.
– Luiz Carvalho
Oh yeah. Sorry. I’ll go over my questions again...
– Juliano
Edit your answer so we can help here too!
– Luiz Carvalho
I managed to solve, I will post below the solution
– Juliano