Elton Santos Elton Santos - 6 months ago 8
SQL Question

How do this consult for refinancing dynamically?

I have this table HistoricRefinancing:

id authorization_id refinancing_id
1 1 7
2 3 7
3 5 6


I just need this:

id authorization_id refinancing_id
1 1 7
2 3 7


and this:

id authorization_id refinancing_id
3 5 6


How I get the refinancing that contain each authorization?
I do select * from HistoricRefinancing where (refinancinfg_id = 7) for example, but how do it dynamically?

Answer

It is the answer:

HistoricRefinancing.where(refinancing_id = params[:refinancing))