Say I have a model
Book with fields
_field2. I want to select only the fields relevant for my code, so I use
Book.select(:id, :field1). However, this returns a relation as follows:
[<#Book id: 12345, field1: "val", _field2: "other_val">].
Can someone explain here why the
select method returns fields starting with underscore even though these have not been passed as an argument? There is no mention of this behaviour in the method documentation.
Note my version of ActiveRecord is 18.104.22.168. Underlying database is MySQL.