4
I have the following method an ROR application.
query_student = "SELECT name, registration, room FROM students WHERE registration = "+
params[:registration]+" AND password = "+params[:password]
@student = ActiveRecord::Base.connection.execute(query_student)
render :json => @student
However it seems to me that in the POO it would not be nice to keep the query in the CONTROLLER.
Does anyone know how I could play this query to model and just instantiate and tals?
I understood, otmo, however this was an example I have other queries that had to be customized with pure sql even, and I would like to put them in the model and only instantiates them... Queries that use 3 JOINS and SUM
– Juliano