sunspot/sunspot — Issue #145: Sunspot 1.3.0 indexing 
Author: jeannettechin
Created: 2011-12-15 15:18:04+00:00
State: open

Hi,

I have a model called Page and it has has_many relationships to another model called Asset. My Asset model has a Carriewave declaration has_attached_file :document (file attachement to the Page model) . Below are my models:

class Asset < ActiveRecord::Base
belongs_to :page
has_attached_file :document
end

class Page < ActiveRecord::Base
has_many :assets, :dependent => :destroy

searchable :if => :published do
text :title , :stored => true , :boost => 2.0
text :body , :stored => true , :boost => 2.0
end
end

When I run this command: bundle exec rake sunspot:solr:reindex --trace

I got this error::

** Invoke sunspot:solr:reindex (first_time)
** Invoke sunspot:reindex (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sunspot:reindex
rake aborted!
undefined method `has_attached_file' for #
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.10/lib/active_record/base.rb:1014:in `method_missing'
/Users/jc/netspace/documentation_sitecss/ukhls_documentation_paul/app/models/asset.rb:4:in `'
/Users/jc/netspace/documentation_sitecss/ukhls_documentation_paul/app/models/asset.rb:1:in `'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `block in require'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:227:in `load_dependency'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/sunspot_rails-1.3.0/lib/sunspot/rails/tasks.rb:30:in `block (3 levels) in '
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/sunspot_rails-1.3.0/lib/sunspot/rails/tasks.rb:30:in `each'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/sunspot_rails-1.3.0/lib/sunspot/rails/tasks.rb:30:in `block (2 levels) in '
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/jc/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/Users/jc/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/bin/rake:32:in `'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `

'
Tasks: TOP => sunspot:solr:reindex => sunspot:reindex

not sure what's going on, can someone help please.

Many thanks, Jeannette