Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not work with polymorphic associations #24

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

Not work with polymorphic associations #24

ayamomiji opened this issue Feb 28, 2011 · 2 comments

Comments

@ayamomiji
Copy link

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'

@nesquena
Copy link

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

@elmatou
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants