mrbrdo/has_moderated — Issue #2: Polymorphic Associations
Author: jackquack
Created: 2011-10-17 19:30:33+00:00
State: open

I am having trouble using this gem with a model FOOBAR which has_one FOO, :through => :BAR. Just to be clear, the model FOO belongs_to BAR which is polymorphic.

Model FOOBAR
has_one :FOO, :as => :BAR
has_moderated_create :with_associations => :all
Model FOO
belongs_to :BAR, :polymorphic => true

It is trying to set FOODBAR= to something when I accept a moderated entry in the FOOBAR table. It should be setting BAR=, because BAR is the name of the polymorphic association name.

An example is
Model Admin
has_one :user, :as => :account
has_moderated_create :with_associations => :all
Model User
belongs_to :account, :polymorphic => true
So, Admin has_moderated_create and when I try to accept an entry in this table using Admin.all.last.accept, I get an exception saying that Admin has no method user=. It is correct that Admin does not have a method user=. The correct method is account=. Admin has_one :user, :as => :account