When I use includes, aliasing in a select clause does not work but when I use joins it does...
#This works and I can do: voters.first.ad_ed
voters = Voter.joins(:voter_election_history).select("voters.ed, voters.ad, concat_ws('/', voters.ad, voters.ed) AS ad_ed, voter_election_histories.e110315").where("voter_election_histories.e110519 IS NULL").order('voters.ed')
#This query returns results but throws an undefined method error when I do voter.first.ad_ed
voters = Voter.includes(:voter_election_history).select("voters.ed, voters.ad, concat_ws('/', voters.ad, voters.ed) AS ad_ed, voter_election_histories.e110315").where("voter_election_histories.e110519 IS NULL").order('voters.ed').references(:voter_election_histories)
Why can't I access the aliased column in an includes query like this but I can do it with joins???