Skip to content
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

Pretty Printer for Arel #8

Open
hosh opened this issue Apr 22, 2010 · 0 comments
Open

Pretty Printer for Arel #8

hosh opened this issue Apr 22, 2010 · 0 comments
Labels

Comments

@hosh
Copy link
Contributor

hosh commented Apr 22, 2010

Currently, the rspec2 branch of remarkable_activerecord has a modified have_scope that matches against the constructed Arel scopes. This is because everything is scoped, and turned into anonymous functions, and so it is difficult to get original conditions passed to Arel. However, Arel itself keeps track of this. The macros work by taking what you pass and constructing an Arel query from scratch, then comparing it with what was declare.

This works very well, however when it comes to printing it, it is very, very ugly. There is no pretty printer for Arel (and no, awesome_print does not actually pretty-print Arel objects). For the moment, I have expectation messages emit SQL instead. It is better than calling inspect on the Arel object, but not that much better.

This is not a huge priority for me, though it is more important if you are planning to print out specs for clients or using i18n. I'd appreciate some help with this part of the code, if anyone can come up with a good pretty-printer for Arel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant