Class: CarrierPickup
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- CarrierPickup
- Includes:
- Models::Auditable
- Defined in:
- app/models/carrier_pickup.rb
Overview
== Schema Information
Table name: carrier_pickups
Database name: primary
id :integer not null, primary key
carrier :string not null
scheduled_end :datetime not null
scheduled_start :datetime not null
created_at :datetime
updated_at :datetime
carrier_account_id :string
carrier_pickup_id :string not null
creator_id :integer
store_id :integer not null
updater_id :integer
Indexes
index_carrier_pickups_on_carrier (carrier)
index_carrier_pickups_on_carrier_account_id (carrier_account_id)
index_carrier_pickups_on_carrier_pickup_id (carrier_pickup_id)
index_carrier_pickups_on_store_id (store_id)
Constant Summary
Constants included from Models::Auditable
Models::Auditable::ALWAYS_IGNORED
Instance Attribute Summary collapse
- #carrier ⇒ Object readonly
- #carrier_account_id ⇒ Object readonly
- #carrier_pickup_id ⇒ Object readonly
- #scheduled_end ⇒ Object readonly
- #scheduled_start ⇒ Object readonly
Belongs to collapse
Methods included from Models::Auditable
Class Method Summary collapse
-
.for_carrier ⇒ ActiveRecord::Relation<CarrierPickup>
A relation of CarrierPickups that are for carrier.
-
.for_carrier_account_id ⇒ ActiveRecord::Relation<CarrierPickup>
A relation of CarrierPickups that are for carrier account id.
-
.for_datetime ⇒ ActiveRecord::Relation<CarrierPickup>
A relation of CarrierPickups that are for datetime.
-
.for_today ⇒ ActiveRecord::Relation<CarrierPickup>
A relation of CarrierPickups that are for today.
-
.future_days ⇒ ActiveRecord::Relation<CarrierPickup>
A relation of CarrierPickups that are future days.
Instance Method Summary collapse
Methods included from Models::Auditable
#all_skipped_columns, #audit_reference_data, #should_not_save_version, #stamp_record
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Instance Attribute Details
#carrier ⇒ Object (readonly)
32 |
# File 'app/models/carrier_pickup.rb', line 32 validates :carrier, presence: true |
#carrier_account_id ⇒ Object (readonly)
33 |
# File 'app/models/carrier_pickup.rb', line 33 validates :carrier_account_id, presence: true |
#carrier_pickup_id ⇒ Object (readonly)
34 |
# File 'app/models/carrier_pickup.rb', line 34 validates :carrier_pickup_id, presence: true |
#scheduled_end ⇒ Object (readonly)
36 |
# File 'app/models/carrier_pickup.rb', line 36 validates :scheduled_end, presence: true |
#scheduled_start ⇒ Object (readonly)
35 |
# File 'app/models/carrier_pickup.rb', line 35 validates :scheduled_start, presence: true |
Class Method Details
.for_carrier ⇒ ActiveRecord::Relation<CarrierPickup>
A relation of CarrierPickups that are for carrier. Active Record Scope
41 |
# File 'app/models/carrier_pickup.rb', line 41 scope :for_carrier, ->(carrier) { where(carrier: carrier) } |
.for_carrier_account_id ⇒ ActiveRecord::Relation<CarrierPickup>
A relation of CarrierPickups that are for carrier account id. Active Record Scope
42 |
# File 'app/models/carrier_pickup.rb', line 42 scope :for_carrier_account_id, ->(carrier_account_id) { where(carrier_account_id: carrier_account_id) } |
.for_datetime ⇒ ActiveRecord::Relation<CarrierPickup>
A relation of CarrierPickups that are for datetime. Active Record Scope
45 |
# File 'app/models/carrier_pickup.rb', line 45 scope :for_datetime, -> (datetime) { where(["(scheduled_start >= ?) and (scheduled_end <= ?)", datetime.beginning_of_day, datetime.end_of_day]) } |
.for_today ⇒ ActiveRecord::Relation<CarrierPickup>
A relation of CarrierPickups that are for today. Active Record Scope
43 |
# File 'app/models/carrier_pickup.rb', line 43 scope :for_today, -> { where(["(scheduled_start >= ?) and (scheduled_end <= ?)", Time.current.beginning_of_day, Time.current.end_of_day]) } |
.future_days ⇒ ActiveRecord::Relation<CarrierPickup>
A relation of CarrierPickups that are future days. Active Record Scope
44 |
# File 'app/models/carrier_pickup.rb', line 44 scope :future_days, -> { where(["scheduled_start >= ?", Time.current.end_of_day]) } |
Instance Method Details
#scheduled_date ⇒ Object
47 48 49 |
# File 'app/models/carrier_pickup.rb', line 47 def scheduled_date scheduled_start.to_date end |