You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rails generates a select statement that does not join the right tables, but still includes them in the where clause. This results in an invalid SQL statement that causes a database exception.
Workarounds
If you call #load on the relation before trying to generate a cache key, it is able to calculate the key on the data in memory, which avoids making any SQL statements.
Of course, that means now all your data has been loaded into memory, which is probably what you were trying to avoid by using caching.
System configuration
Rails version: 5.1.3 (test case is against master)
Ruby version: 2.3.3
The text was updated successfully, but these errors were encountered:
Steps to reproduce
Test case: https://gist.github.com/dpogue/f168bc6bc24848396bf6694623532b3a
Expected behavior
Rails should generate a cache key
Actual behavior
Rails generates a select statement that does not join the right tables, but still includes them in the where clause. This results in an invalid SQL statement that causes a database exception.
Workarounds
If you call
#load
on the relation before trying to generate a cache key, it is able to calculate the key on the data in memory, which avoids making any SQL statements.Of course, that means now all your data has been loaded into memory, which is probably what you were trying to avoid by using caching.
System configuration
Rails version: 5.1.3 (test case is against master)
Ruby version: 2.3.3
The text was updated successfully, but these errors were encountered: