Exception: ActiveRecord::UnionRelation::MismatchedColumnsError

Inherits:
Error
  • Object
show all
Defined in:
lib/active_record/union_relation.rb

Overview

Unions require that the number of columns coming from each subrelation all match. When we pull the attributes out an instantiate the actual objects, we then map them back to the original attribute names.

Instance Method Summary collapse

Constructor Details

#initialize(columns, sources) ⇒ MismatchedColumnsError

Returns a new instance of MismatchedColumnsError.



15
16
17
# File 'lib/active_record/union_relation.rb', line 15

def initialize(columns, sources)
  super("Expected #{columns.length} columns but got #{sources.length}")
end