Getting A Users Change History Using Audited Gem

Posted by Weston Ganger

Using the audited gem they didnt clearly define how to get a list of all of the changes / history the user has made. I wrote a method to do this

class User < ActiveRecord::Base
  #include Audited ###if your not using Rails or trying this on a different class that is not hooked up to audited yet

  def history
    Audited.audit_class.where(user_id: :desc)

Then it can be used like so:


Make that into an each and generate the history page for your user!

Article Topic:Software Development - Rails

Date:October 17, 2015

Recommended Posts



Send Me A Message

I would love to get in touch and talk about your next project. Feel free to send a message and I will get back to you shortly.

Get Connected