rails 4 rake task fails on heroku [uninitialized constant MODEL] -
i have model screenshot.rb.
defined following rake task
namespace :clean_up_temp desc "clean unsaved screenshots 1 hours ago" task :screenshots => :environment screenshot.destroy_all([ 'created_at<? , title null', 1.hours.ago ]) end end
it works locally.
failed on heroku
running `rake clean_up_temp:screenshots` attached terminal... up, run.2861 rake aborted! uninitialized constant screenshot /app/lib/tasks/clean_up_temp_screenshots.rake:3:in `block in <top (required)>' /app/lib/tasks/clean_up_temp_screenshots.rake:1:in `<top (required)>' /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:641:in `block in run_tasks_blocks' /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:641:in `each' /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:641:in `run_tasks_blocks' /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:244:in `run_tasks_blocks' /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:446:in `load_tasks' /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing' /app/rakefile:6:in `<top (required)>' (see full trace running task --trace)
i tried add
config.dependency_loading = true if $rails_rake_task
in production.rb
how can solve problem
Comments
Post a Comment