Add a rules controller
This commit is contained in:
@@ -62,8 +62,15 @@ class Rule < ApplicationRecord
|
||||
end
|
||||
|
||||
# Class method to get latest version (for sync cursor)
|
||||
# Returns microsecond Unix timestamp for efficient machine comparison
|
||||
def self.latest_version
|
||||
maximum(:updated_at)&.iso8601(6) || Time.current.iso8601(6)
|
||||
max_time = maximum(:updated_at)
|
||||
if max_time
|
||||
# Convert to microseconds since epoch
|
||||
(max_time.to_f * 1_000_000).to_i
|
||||
else
|
||||
(Time.current.to_f * 1_000_000).to_i
|
||||
end
|
||||
end
|
||||
|
||||
# Disable rule (soft delete)
|
||||
|
||||
Reference in New Issue
Block a user