Heroku Scheduler - Build Task Error -
i'm running ap on heroku that's making googleplaces api call button. i'm trying use heroku scheduler make call automatically once day. i'm getting error in terminal : rake aborted! don't know how build task 'sync_all' (see --tasks)
the main bulk of code works in controller. can tell me i'm missing? i've emptied code out , ran see if "puts" showed , still gives error.
lib/tasks/scheduler.rake
desc "this task syncs locations." task :sync_all => :environment puts "syncing all" all_locations = location.all all_locations.each |l| result = googleplacesapi.details(l.google_place_id) json = json.parse(result.body) json['result']['reviews'].each |t| review.find_or_create_by( authorname: t['author_name'], rating: t['rating'], text: t['text'], relativetime: t['relative_time_description'], user_id: l.user_id, location_id: l.id ) end l.update_attribute(:synced, true) tempcount = l.sync_count count = tempcount + 1 l.update_attribute(:sync_count, count) end puts "sync completed!" end
Comments
Post a Comment