Open callmeed opened 10 years ago
You're running the task incorrectly, please see the documentation.
Also, Tire is deprecated, please use the elasticsearch-rails gem.
On 1. 8. 2014, at 20:33, Erik Dungan notifications@github.com wrote:
I'm running tire 0.6.2 with a Rails 3.2x app and ES 0.9.0. I'm trying to use the tire:import:model rake task and get an error as if it can't find my ActiveRecord class.
Command I run:
rake tire:import:model CLASS=Garage RAILS_ENV=staging --trace
Error I get:
* Invoke tire:import:model (first_time) * Execute tire:import:model rake aborted! uninitialized constant Garage /var/www/smr/shared/bundle/ruby/1.9.1/gems/tire-0.6.2/lib/tire/tasks.rb:95:in
eval' /var/www/smr/shared/bundle/ruby/1.9.1/gems/tire-0.6.2/lib/tire/tasks.rb:95:in
eval' /var/www/smr/shared/bundle/ruby/1.9.1/gems/tire-0.6.2/lib/tire/tasks.rb:95:inblock (3 levels) in <top (required)>' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:236:in
call' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:236:inblock in execute' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:231:in
each' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:231:inexecute' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:175:in
block in invoke_with_call_chain' /usr/lib/ruby/1.9.1/monitor.rb:211:inmon_synchronize' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:168:in
invoke_with_call_chain' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:161:ininvoke' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:149:in
invoke_task' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:106:inblock (2 levels) in top_level' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:106:in
each' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:106:inblock in top_level' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:115:in
run_with_threads' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:100:intop_level' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:78:in
block in run' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:165:instandard_exception_handling' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:75:in
run' /var/www/smr/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/bin/rake:33:in<top (required)>' /var/www/smr/shared/bundle/ruby/1.9.1/bin/rake:23:in
load' /var/www/smr/shared/bundle/ruby/1.9.1/bin/rake:23:in `' Tasks: TOP => tire:import:model — Reply to this email directly or view it on GitHub.
So, it should be like this?
rake environment tire:import CLASS='Article' FORCE=true
My only question is that seems to differ from the outline when you rake -T:
rake tire:import:all # Import all indices from `app/models` (or use DIR environment variable)
rake tire:import:model # Import data from your model (pass name as CLASS environment variable)
rake tire:index:drop # Delete indices passed in the INDEX/INDICES environment variable; separate multiple indices by comma
Yes, exactly!
rake -T
only lists the tasks themselves, but to load Rails environment, you need to call the environment
task as well. There has been discussion about it, and some patches, but in the end, this seemed like the best solution.
The new gem uses that approach as well -- again, please don't use Tire, use the new gem.
I'm running tire 0.6.2 with a Rails 3.2x app and ES 0.9.0. I'm trying to use the tire:import:model rake task and get an error as if it can't find my ActiveRecord class.
Command I run:
rake tire:import:model CLASS=Garage RAILS_ENV=staging --trace
Error I get: