users table stuff
I like to use an 'arex' helper method to wrap arbitrary active record queries...
... with conditions
... with a join, can get tricky
using additional Arel tables seems to clear this up
and you can relax it a bit too
get a relation's columns
Get join table relations...
So ... stored procedures :D
Could you express the following as Arel... ?
And the answer, as it turns out, is yes, somewhat ...
In sql you have column aliases (AS) and table (or *relation*) aliases (table_alias)
sadly this is considerably more verbose than just using connection.execute with the sql
The top level Arel classes
Using arel for data analysis
The nice thing about active record is that it works for mvc really well
But if you want to do data analysis, such as working out the function of some data, it's not so good
So if we want to analyse bidding data:
How many bids placed by day of the week
... or day of the year
add in the date as a field, and get the number per month since launch
get the number per day ...
add in the status of the bid ...