Not work with polymorphic associations #24

Open
ayamomiji opened this Issue Feb 28, 2011 · 2 comments

Comments

Projects
None yet
3 participants
class Comment < ActiveRecord::Base
  belongs_to :item, :polymorphic => true
end

when i run db:migrate -t
it gives
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
uninitialized constant Comment::Item
/home/ayaya/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.5/lib/active_record/base.rb:1199:in compute_type' /home/ayaya/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.5/lib/active_record/reflection.rb:162:inklass'
/home/ayaya/.rvm/gems/ruby-1.9.2-p180/gems/acts_as_archive-0.4.0/lib/acts_as_archive.rb:130:in block in acts_as_archive' /home/ayaya/.rvm/gems/ruby-1.9.2-p180/gems/acts_as_archive-0.4.0/lib/acts_as_archive.rb:129:ineach'
/home/ayaya/.rvm/gems/ruby-1.9.2-p180/gems/acts_as_archive-0.4.0/lib/acts_as_archive.rb:129:in acts_as_archive' /home/ayaya/.rvm/gems/ruby-1.9.2-p180/gems/acts_as_archive-0.4.0/lib/acts_as_archive.rb:56:inblock (2 levels) in load_from_yaml'
/home/ayaya/.rvm/gems/ruby-1.9.2-p180/gems/acts_as_archive-0.4.0/lib/acts_as_archive.rb:55:in each' /home/ayaya/.rvm/gems/ruby-1.9.2-p180/gems/acts_as_archive-0.4.0/lib/acts_as_archive.rb:55:inblock in load_from_yaml'
/home/ayaya/.rvm/gems/ruby-1.9.2-p180/gems/acts_as_archive-0.4.0/lib/acts_as_archive.rb:47:in each' /home/ayaya/.rvm/gems/ruby-1.9.2-p180/gems/acts_as_archive-0.4.0/lib/acts_as_archive.rb:47:inload_from_yaml'
/home/ayaya/.rvm/gems/ruby-1.9.2-p180/gems/acts_as_archive-0.4.0/lib/acts_as_archive/adapters/rails3.rb:4:in block in <class:ActsAsArchiveRailtie>' /home/ayaya/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/initializable.rb:25:ininstance_exec'

Yes, I have experienced this as well. It has to do with compute_type in AR being called during the acts_as_archive declaration.

Collaborator

elmatou commented Mar 15, 2011

I send a pull request on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment