0

Good day,

I am using this Gem: Public_activity

Gemfile

gem 'public_activity', :git => 'https://github.com/chaps-io/public_activity.git', :branch => '1-6-stable'

Then I am tracking changes in this model:

Model Event

include PublicActivity::Model
tracked owner: Proc.new{ |controller, model| controller.current_user }, params:{ "obj"=> proc {|controller, model_instance| model_instance.changes}}

I am inspecting the variable in the view I got:

#<ActiveRecord::Relation [
  #<PublicActivity::Activity 
  id: 21, 
  trackable_type: "Event", 
  trackable_id: 8, 
  owner_type: "User", 
  owner_id: 13, 
  key: "event.update", 
  parameters: 
    { "obj"=> { "množství"=>["", "1"], 
      "updated_at"=>[Thu, 04 May 2017 12:07:25 CEST +02:00, Thu, 04 May 2017 13:36:22 CEST +02:00] } 
    }, 
    recipient_type: nil, 
    recipient_id: nil, 
    created_at: "2017-05-04 11:36:22", 
    updated_at: "2017-05-04 11:36:22"
  >
]>

The question is how can I show the info from the object, the idea is simple: table with column field and new and old values. But I am more than welcome to see any ideas how to show data from the object in a view as I can't find how to display it

Maxim Fedotov
  • 1,349
  • 1
  • 18
  • 38
T.Krmela
  • 33
  • 10

1 Answers1

0

If you want to track changes to the models, then you should use a gem dedicated for that, for example https://github.com/airblade/paper_trail.

PublicActivity is mainly for tracking actions your users take on your website.

Disclaimer: I am the maintainer of PublicActivity.

Piotrek Okoński
  • 600
  • 8
  • 17