-
Notifications
You must be signed in to change notification settings - Fork 10
[WIP] [POC] Implement Condensed VA syntax #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| arel ||= virtual_delegate_arel(source, to_ref) | ||
| elsif block_given? | ||
| define_method(name) do | ||
| has_attribute?(name) ? self[name] : instance_eval(&block) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is so nice.
Before
We can do minimal common manipulations for sql in the TableProxy, but can't do any common manipulation for the ruby code.
After
Adding stuff to ruby like the has_attribute? pattern is a big win.
Besides cutting down on the noise, we often forget to add this block and forgetting it can cause problems at runtime.
|
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the |
|
Checked commit kbrock@c0e1033 with ruby 3.1.7, rubocop 1.56.3, haml-lint 0.64.0, and yamllint spec/db/models.rb
|
|
@Fryguy Where are you on this?
Re 3: If you would like to pair up to derive SQL from Ruby, we can talk. It is very academic and probably not possible. I always think of defunkt/ambition, where he wrote LDAP/SQL from Ruby. Since we are standardized on the Prizm parser, it would have longer staying power. But guessing that improving Re 4: This was the reason I aborted this PR. Didn't profile this, but there is a reason why Rails introduced |
|
I love this. Waiting on moving forward at the moment though because @jrafanie is doing Rails 8 support first and I don't want to get in his way. |
WIP: still have to convert across
WIP: need to verify this doesn't bloat memory too much due to class closure in the lambda
Fixes #203
===
Not thrilled that we are keeping the method closure from virtual_attribute. that has quite a bit of data in there and the lambda