Sha256: f0616f0316cee2a3095aa34f6f252de9b3f7c4161501f515a18adf5449fe6304

Contents?: true

Size: 595 Bytes

Versions: 3

Compression:

Stored size: 595 Bytes

Contents

module KirguduBase
	module Concerns::Models::UpdatedBy
		extend ActiveSupport::Concern


		included do
			before_query :query_add_updated_by

			belongs_to :updater, class_name: "::KirguduBase::Security::User", foreign_key: :updated_by
			scope :by_updated_by, lambda { |value| where(updated_by: value) if value }


		end


		def updater_name
			updater.full_name if updater
		end
		############################ CLASS METHODS ###############################

		module ClassMethods
			def query_add_updated_by(query, filters)
				query.by_updated_by(filters[:updated_by])
			end
		end
	end
end


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kirgudu_base-0.0.25 app/models/kirgudu_base/concerns/models/updated_by.rb
kirgudu_base-0.0.23 app/models/kirgudu_base/concerns/models/updated_by.rb
kirgudu_base-0.0.22 app/models/kirgudu_base/concerns/models/updated_by.rb