Reducing my use case (not really tested, let me know if this needs clarification)
class SomeModel < ActiveRecord::Base
has_many :children
calculated :some_attribute, -> { ... }
scope :with_other_model do
select(:id)
end
default_scope { calculated(:some_attribute }
end
# Usage:
SomeModel.with_other_model # => SELECT id, (...) AS some_attribute ...
This affects the ability to use a scope with calculated attributes as a subquery. I'd imagine the calculated attributes would need to be removed if a select is applied onto the scope.