Sha256: c806d623227b578e5e2539f94322fb9db95462f04b3640364da915732a6d239b

Contents?: true

Size: 554 Bytes

Versions: 4

Compression:

Stored size: 554 Bytes

Contents

# frozen_string_literal: true

module PandaCms
  module Admin
    class UserActivityComponent < ViewComponent::Base
      attr_accessor :model
      attr_accessor :updated_at
      attr_accessor :user

      # @param whodunnit_to [ActiveRecord::Base] Model instance to which the user activity is related
      def initialize(whodunnit_to: nil)
        @model = whodunnit_to
        whodunnit_id = @model.versions&.last&.whodunnit
        @user = User.find(whodunnit_id) if whodunnit_id
        @updated_at = @model.updated_at
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
panda_cms-0.5.3 app/components/panda_cms/admin/user_activity_component.rb
panda_cms-0.5.2 app/components/panda_cms/admin/user_activity_component.rb
panda_cms-0.5.1 app/components/panda_cms/admin/user_activity_component.rb
panda_cms-0.5.0 app/components/panda_cms/admin/user_activity_component.rb