This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TrackWorker | |
@queue = :tracking | |
def self.perform params | |
params = params.with_indifferent_access | |
device_id = params[:device_id] | |
ts = params[:timestamp] | |
lat = params[:latitude] | |
lon = params[:longitude] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Latlon < ActiveRecord::Base | |
#has_one :geolocation, foreign_key: "latlon_id" | |
validates_presence_of :lat, :lon, :ts, :device_id | |
def self.track params | |
#message, status = validate_params params | |
status = Resque.enqueue(TrackWorker, params) | |
if status | |
return 200 | |
else | |
return 500 |