Class: Conveyance
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Conveyance
- Includes:
- Housekeeping, Shared::Citations, Shared::IsData, Shared::Notes, Shared::PolymorphicAnnotator, Shared::Tags
- Defined in:
- app/models/conveyance.rb
Instance Attribute Summary collapse
-
#end_time ⇒ Numeric
In seconds.
Instance Method Summary collapse
- #end_time_after_start ⇒ Object protected
Methods included from Shared::IsData
#errors_excepting, #full_error_messages_excepting, #identical, #is_community?, #is_destroyable?, #is_editable?, #is_in_use?, #is_in_users_projects?, #metamorphosize, #similar
Methods included from Shared::PolymorphicAnnotator
#annotated_object_is_persisted?
Methods included from Shared::Tags
#reject_tags, #tag_with, #tagged?, #tagged_with?
Methods included from Shared::Notes
#concatenated_notes_string, #reject_notes
Methods included from Shared::Citations
#cited?, #mark_citations_for_destruction, #nomenclature_date, #origin_citation_source_id, #reject_citations, #requires_citation?, #sources_by_topic_id
Methods included from Housekeeping
#has_polymorphic_relationship?
Methods inherited from ApplicationRecord
Instance Attribute Details
#end_time ⇒ Numeric
Returns in seconds.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/models/conveyance.rb', line 24 class Conveyance < ApplicationRecord include Housekeeping include Shared::Citations include Shared::Notes include Shared::Tags include Shared::PolymorphicAnnotator include Shared::IsData polymorphic_annotates(:conveyance_object) acts_as_list scope: [:project_id, :conveyance_object_type, :conveyance_object_id] belongs_to :sound, inverse_of: :conveyances belongs_to :conveyance_object, polymorphic: true validates_presence_of :conveyance_object, :sound validates_uniqueness_of :sound_id, scope: [:conveyance_object_type, :conveyance_object_id] validate :end_time_after_start accepts_nested_attributes_for :sound protected def end_time_after_start if (start_time && end_time) && start_time > end_time errors.add(:end_time, 'must be after start time') end end end |
Instance Method Details
#end_time_after_start ⇒ Object (protected)
48 49 50 51 52 |
# File 'app/models/conveyance.rb', line 48 def end_time_after_start if (start_time && end_time) && start_time > end_time errors.add(:end_time, 'must be after start time') end end |