Forum: Ruby on Rails PGError "unknown column" on polymorphic association column

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
3dd4b52a0946bd698b1d1635a46ea3a3?d=identicon&s=25 François Beausoleil (fbeausoleil)
on 2007-03-19 04:48
(Received via mailing list)
Hi all !

This is very strange.  I am attempting to get my application running
on PostgreSQL (from MySQL), and I get this error:

ActiveRecord::StatementInvalid: PGError: ERREUR:  la colonne «Party»
n'existe pas
: SELECT * FROM contact_routes WHERE (routable_type = "Party" AND
routable_id = 1000013)  ORDER BY position DESC LIMIT 1

It translates to "The Party column does not exist".  I ran the
statement in psql, and sure enough, I get the same error.  If I quote
the routable_type column's value using single-quotes, I get the
expected results.

My models look like this:

class Party < AR::B
  has_many :contact_routes, :as => :routable

class ContactRoute < AR::B
  belongs_to :routable, :polymorphic => true

I'm on the 1.2 stable branch, using Ruby 1.8.4 and PostgreSQL 8.1.

Thanks !
François Beausoleil
This topic is locked and can not be replied to.