Open wycleffsean opened 9 years ago
I just saw this. I don't like the brackets. I don't like the symbols, because they are strings. You can get that whole thing by delegating brackets to Foo.arel_table
.
I was thinking that it would be better to maybe attach a submodule where all this stuff could live to each AR class. Then you could reference it explicitly, or maybe even a query builder method that passes the stuff you want, like:
# A, B, C ... are classes derived from AR::Base
complex_arel = with_tables(A, B, C) do |a, b, c|
# a is a ref A::Table or something
# ... some thing where you can use a.name, etc. with no name conflicts
end
Then you can be explicit, get the sugar, and avoid monkey-patching. You could use it pretty flexibly then.
Consider overloading bracket operator for retrieving arel attributes like in https://github.com/camertron/arel-helpers
avoids the
*_column
naming foolery