Why do you have to do “result[0][column]” when column is a variable?
easy enough:
result[0] is an object and result[0].xxx calls a function of this object
all columns are defined as functions for ActiveRecord objects
but your column is a string, containing the column name. there is no
function column, since there is no column with that name
ActiveRecord::[] is just an alternative way to request the content of a
col in a slightly more flexible way, by handing over the name as a
string
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.