Today I Learned

SQLite3::RangeException: column index out of range

If you encounter the error:

SQLite3::RangeException: column index out of range

one of the things you might do is to investigate the broken query (joins/includes) and check if there is any association with limit condition like in the example below:

has_one :current_term, -> { order(created_at: :desc).limit(1) }, class_name: "Term"

the solution is to remove limit

has_one :current_term, -> { order(created_at: :desc) }, class_name: "Term"