Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Merge requests
  • !124

[BUGFIX] Better detection of application models

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge gw-verify-table-exists into master Nov 02, 2015
  • Overview 4
  • Commits 1
  • Pipelines 0
  • Changes 3

Created by: gracewashere

Closes #122 (closed).

Problem:

Administrate assumes that all subclasses of ActiveRecord::Base are backed by database tables.

When a host application or gem defines a subclass of ActiveRecord::Base that doesn't have a corresponding database table, the installation generator sees an error:

postgresql_adapter.rb:596:in `async_exec': PG::UndefinedTable: ERROR:  relation "read_marks" does not exist (ActiveRecord::StatementInvalid)
LINE 5:                WHERE a.attrelid = '"read_marks"'::regclass
                                          ^
:               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
                FROM pg_attribute a LEFT JOIN pg_attrdef d
                  ON a.attrelid = d.adrelid AND a.attnum = d.adnum
               WHERE a.attrelid = '"read_marks"'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum

Solution:

Verify that a model's database table exists before creating the model's dashboard.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: gw-verify-table-exists