You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mongoid_userstamp Gem is not working with mongoid5. ( nosolosoftware/mongoid_userstamp#27) Do we have any alternative to store user_id when we create HistoryTracker object?
Thanks
The text was updated successfully, but these errors were encountered:
I wound up rolling my own based on mongoid_userstamps. Added
class HistoryTracker
include Mongoid::History::Tracker
before_create :set_modifier
protected
def set_modifier
self.modifier = Auditing.current_user
end
end
class Auditing
class << self
def current_user
Thread.current['auditing:current_user']
end
def current_user=(user)
Thread.current['auditing:current_user'] = user
end
end
end
Then added a before_filter in my ApplicationController that set the Auditing.current_user to the current_user from devise.
We still recommend the userstamp gem while it hasn't been supported since mongoid 4. Maybe someone cares to remove it from the documentation altogether or suggest an alternative?
HI
Mongoid_userstamp Gem is not working with mongoid5. ( nosolosoftware/mongoid_userstamp#27) Do we have any alternative to store user_id when we create HistoryTracker object?
Thanks
The text was updated successfully, but these errors were encountered: