sferik/rails_admin — Issue #980: PGError: ERROR: relation does not exist
Author: Zapotek
Created: 2012-02-14 21:39:56+00:00
State: open

Hi,

I keep getting the following error:

```
: SELECT "findings".* FROM "findings" INNER JOIN "findings_issues" ON "findings"."id" = "findings_issues"."finding_id" WHERE "findings_issues"."issue_id" = 5
Rendered /home/zapotek/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails_admin-d76bec1638f4/app/views/rails_admin/main/show.html.haml within layouts/rails_admin/application (154.8ms)
Completed 500 Internal Server Error in 294ms

ActionView::Template::Error (PGError: ERROR: relation "findings_issues" does not exist
LINE 1: SELECT "findings".* FROM "findings" INNER JOIN "findings_iss...
^
: SELECT "findings".* FROM "findings" INNER JOIN "findings_issues" ON "findings"."id" = "findings_issues"."finding_id" WHERE "findings_issues"."issue_id" = 5):
1: - @model_config.show.with(:object => @object, :view => self).visible_groups.each do |fieldset|
2: - unless (fields = fieldset.with(:object => @object, :view => self).visible_fields).empty?
3: - if !(values = fields.map{ |f| v = f.value; (!v.nil? && v != '' && v != []) ? v : nil }).compact.empty? || !RailsAdmin::config.compact_show_view
4: .fieldset
5: %h4
6: = fieldset.label
```

The problem is that the table in question ("findings_issues") indeed doesn't exist nor is referenced anywhere.
The relation is as follows:

* Issues has_and_belongs_to_many :findings
* Finding belongs_to :issue

The error occurs when trying to show any Issue entry.