I am struggling with an issue with a Rails 5.2.4.1 app. Configuration is the following:
- Ruby 2.6.5
- Rails 5.2.4.1
- attr_encrypted 3.1.0
I have a model called Chicken that has 2 attributes: name
- which is attr_encrypted and number
- which is a normal integer field. Whenever I perform queries to retrieve any other fields except the attr_encrypted one, that still gets attached to the result and it's alway nil
:
Chicken.select(:number) => #<ActiveRecord::Relation [#<Chicken id: nil, number: nil, name: nil>]>
Please keep in mind that this is just a test application and the queries that I am trying to execute on the actual app where I have encountered this initially, are more complex.
Is there a way to prevent attr_encrypted from attaching encrypted fields to queries results? Since the current results mean that I have to re-write all the existing queries in the app or add a filter for these types of fields somehow