Sha256: 62aa7dfafd6d34fb80394a0bd906df8f37c3bfe78fbcbd44e1e603f6e597afd8

Contents?: true

Size: 756 Bytes

Versions: 3

Compression:

Stored size: 756 Bytes

Contents

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

		included do
			############################ FILTERS ###############################
			before_query :query_add_status_id

			############################ SCOPES ###############################
			base.scope :by_status, lambda { |value| where(status_id: value) if value }
		end

		############################ INSTANCE METHODS ###############################

		def status_name
			I18n.t("kirgudu_base.common.enums.deletion_status.#{self.status_id}")
		end

		############################ CLASS METHODS ###############################
		module ClassMethods
			def query_add_status_id(query, filters)
				query.by_status_id(filters[:status_id])
			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/status_id.rb
kirgudu_base-0.0.23 app/models/kirgudu_base/concerns/models/status_id.rb
kirgudu_base-0.0.22 app/models/kirgudu_base/concerns/models/status_id.rb