Skip to content
  • Elliot Winkler's avatar
    d47801b8
    Scopes can be array columns for uniq. validator · d47801b8
    Elliot Winkler authored
    `validates_uniqueness_of` would blow up when used with a scope that was
    an array column. The validator must perform a query to determine whether
    the record already exists in the database, and uses the scope to do so.
    When it constructs the query, it deserializes the value of the scope (an
    array). Unfortunately this breaks the query because Postgres is still
    expecting that value to be an array. There is a newer version of Arel
    that prevents this from happening, but 4.1 is not on that version, so we
    have to emulate that code here.
    d47801b8
    Scopes can be array columns for uniq. validator
    Elliot Winkler authored
    `validates_uniqueness_of` would blow up when used with a scope that was
    an array column. The validator must perform a query to determine whether
    the record already exists in the database, and uses the scope to do so.
    When it constructs the query, it deserializes the value of the scope (an
    array). Unfortunately this breaks the query because Postgres is still
    expecting that value to be an array. There is a newer version of Arel
    that prevents this from happening, but 4.1 is not on that version, so we
    have to emulate that code here.
Loading