Open montulli opened 5 years ago
Hi @montulli Thanks for the request! This has sort of already been built.
https://querybuilder.js.org/plugins.html#sql-support
The jQuery plugin can generate the sql for you - you could then send that through to your server.
Pretty scary getting sql from a frontend... It should be possible to use something like https://github.com/cowboyd/therubyracer to run it server-side tho.
I can't trust SQL coming from the front end and running JavaScript on the server side seems inefficient. I have a working implementation now of SQL generation in RUBY in my branch that is here: https://github.com/jetinsight/jquery_query_builder-rails
If you are interested, I can make a pull request so you can review it. I'm happy to make changes to suit your requirements.
Big feature request I know. :)
If this library could build active record scopes based on the filter params it would be god like!
Also of interest, generic SQL queries. (That might be easier than using active record)