Skip to content
This repository was archived by the owner on Jun 1, 2021. It is now read-only.
This repository was archived by the owner on Jun 1, 2021. It is now read-only.

Duplicate column name 'id' when the scope already selects columns #2

@mbillard

Description

@mbillard

If the scope already selects columns:

@items = Item.select('`items`.*')

Then calling the cache on the scope directly will raise an error:

cache [@items] do
  ...

The error:

Mysql2::Error: Duplicate column name 'id': SELECT CONCAT(`id`, '-', `updated_at`) FROM (SELECT  `items`.*, items.id, items.updated_at FROM ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions