Class: AdditionalCallCredit

Inherits:
ApplicationRecord show all
Includes:
Models::Auditable
Defined in:
app/models/additional_call_credit.rb

Overview

== Schema Information

Table name: additional_call_credits
Database name: primary

id :integer not null, primary key
additional_credits :float not null
credits_date :date
notes :string(1000)
created_at :datetime not null
updated_at :datetime not null
creator_id :integer
employee_id :integer not null
updater_id :integer

Indexes

index_additional_call_credits_on_credits_date (credits_date)
index_additional_call_credits_on_employee_id (employee_id)

Constant Summary

Constants included from Models::Auditable

Models::Auditable::ALWAYS_IGNORED

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from Models::Auditable

#all_skipped_columns, #audit_reference_data, #creator, #should_not_save_version, #stamp_record, #updater

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Models::EventPublishable

#publish_event

Instance Attribute Details

#additional_creditsObject (readonly)



32
# File 'app/models/additional_call_credit.rb', line 32

validates :employee_id, :additional_credits, :credits_date, presence: true

#credits_dateObject (readonly)



32
# File 'app/models/additional_call_credit.rb', line 32

validates :employee_id, :additional_credits, :credits_date, presence: true

#employee_idObject (readonly)



32
# File 'app/models/additional_call_credit.rb', line 32

validates :employee_id, :additional_credits, :credits_date, presence: true

Class Method Details

.activeActiveRecord::Relation<AdditionalCallCredit>

A relation of AdditionalCallCredits that are active. Active Record Scope

Returns:

See Also:



25
# File 'app/models/additional_call_credit.rb', line 25

scope :active, -> { where(employee_id: Employee.active) }

.sortedActiveRecord::Relation<AdditionalCallCredit>

A relation of AdditionalCallCredits that are sorted. Active Record Scope

Returns:

See Also:



24
# File 'app/models/additional_call_credit.rb', line 24

scope :sorted, -> { order(credits_date: :desc) }

.with_employee_nameActiveRecord::Relation<AdditionalCallCredit>

A relation of AdditionalCallCredits that are with employee name. Active Record Scope

Returns:

See Also:



26
# File 'app/models/additional_call_credit.rb', line 26

scope :with_employee_name, -> { select('additional_call_credits.*,(select full_name from parties where id = employee_id) as employee_name') }