Closed stevepolitodesign closed 2 years ago
We need to call iso8601 on any duration passed to a scope in order for the query to execute correctly. This is odd because Rails should know how to cast this value by default.
iso8601
scope :quick, -> { joins(:steps).group(:id).having("SUM(duration) <= ?", 15.minutes) } Recipe.quick # => operator does not exist: interval <= integer
After further research, I determined that this is the expected behavior. Using a hash condition solves for this otherwise.
We need to call
iso8601
on any duration passed to a scope in order for the query to execute correctly. This is odd because Rails should know how to cast this value by default.