You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code uses Activerecord::Ordered hash to iterate through the returned records and creates a nested hash. Postgres and SQLite both support returning records as a json and it's possible to write the queries so that the database constructs the nested json structure. Since most database drivers are written in C and since the database itself can perform this task much faster than ruby using less memory it would be a handy feature have this as an option.
This way you may be able to just pass that JSON on to a view/front end/api client without any ruby processing at all.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
The code uses Activerecord::Ordered hash to iterate through the returned records and creates a nested hash. Postgres and SQLite both support returning records as a json and it's possible to write the queries so that the database constructs the nested json structure. Since most database drivers are written in C and since the database itself can perform this task much faster than ruby using less memory it would be a handy feature have this as an option.
This way you may be able to just pass that JSON on to a view/front end/api client without any ruby processing at all.
All reactions