has_many_polymorphs and acts_as_list ?

First, BRAVO for this wonderful plugin: has_many_polymorphs ! Now my problem:

4 models : Collection, Page, Fragment, Belonging (which is the join table):

  1 class Collection < ActiveRecord::Base   2 has_many_polymorphs :elements,   3 :through => :belongings,   4 :from => [:pages, :fragments, :collections],   5 :as => :collector,   6 :parent_order => 'belongings.position'   7 end

  1 class Page < ActiveRecord::Base   2 has_many :fragments   3 end

  1 class Fragment < ActiveRecord::Base   2 belongs_to :page   3 end

  1 class Belonging < ActiveRecord::Base   2 belongs_to :collector,   3 :class_name => "Collection",   4 :foreign_key => "collector_id"   5 belongs_to :element, :polymorphic => true   6 acts_as_list :scope => 'element_id=#{element_id} and element_type=#{quote_value element_type}'   7 end

The belongings database table structure:

collector_id (integer) ; element_id (integer) ; element_type (string) ; position (integer)

The self referential polymorphic aspect works like a charm! But the acts_as_list doesn't! Here a demonstration inside the console:

c = Collection.create(:name => "C1") c.elements << Page.create(:name => "P1") c.elements << Page.create(:name => "P2") y c

--- &id006 !ruby/object:Collection attributes:   name: C1   updated_at: &id001 2007-11-14 13:17:45.877143 +01:00   id: 1   created_at: *id001 belongings: - !ruby/object:Belonging   attributes:     updated_at: 2007-11-14 13:18:39     element_id: "1"     id: "1"     collector_id: "1"     element_type: Page     position: "1"     created_at: 2007-11-14 13:18:39 - !ruby/object:Belonging   attributes:     updated_at: 2007-11-14 13:19:06     element_id: "2"     id: "2"     collector_id: "1"     element_type: Page     position: "1"     created_at: 2007-11-14 13:19:06 elements: - &id003 !ruby/object:Page   attributes:     name: P1     updated_at: &id002 2007-11-14 13:18:39.397292 +01:00     id: 1     created_at: *id002   errors: !ruby/object:ActiveRecord::Errors     base: *id003     errors: {}

  new_record: false   new_record_before_save: true - &id005 !ruby/object:Page   attributes:     name: P2     updated_at: &id004 2007-11-14 13:19:06.052972 +01:00     id: 2     created_at: *id004   errors: !ruby/object:ActiveRecord::Errors     base: *id005     errors: {}

  new_record: false   new_record_before_save: true errors: !ruby/object:ActiveRecord::Errors   base: *id006   errors: {}

new_record: false new_record_before_save: true => nil

c.elements.first.move_to_bottom

NoMethodError: undefined method `move_to_bottom' for #<Page:0x3318ba4>         from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/base.rb:1860:in `method_missing'         from (irb):8

I would be very pleased if you could help me ...

Just for completness ... In fact I have to refer to the belongings table when interested by the acts_as_list behavior. So: c.belongings.first.move_to_bottom And not: c.elements.first.move_to_bottom etc. etc.

And in my case the scope I meant wasn't: element_id=#{element_id} and element_type=#{quote_value element_type}' But: collector_id Since I want the elements inside a collection to act as a list.