Sha256: 684ef6a9bd538df6da80d0c2bc449cb70626370e90791f6925c0fe7079aa3c00
Contents?: true
Size: 1.15 KB
Versions: 8
Compression:
Stored size: 1.15 KB
Contents
class Chouette::StopPoint < Chouette::TridentActiveRecord # FIXME http://jira.codehaus.org/browse/JRUBY-6358 self.primary_key = "id" belongs_to :stop_area belongs_to :route, inverse_of: :stop_points acts_as_list :scope => 'route_id = \'#{route.id}\'',:top_of_list => 0 attr_accessible :route_id, :stop_area_id, :objectid, :object_version, :creation_time, :creator_id, :position has_many :vehicle_journey_at_stops, :dependent => :destroy has_many :vehicle_journeys, :through => :vehicle_journey_at_stops, :uniq => true before_destroy :remove_dependent_journey_pattern_stop_points validates_presence_of :stop_area validate :stop_area_id_validation scope :default_order, order("position") def stop_area_id_validation if stop_area_id.nil? errors.add(:stop_area_id, I18n.t("errors.messages.empty")) end end def self.area_candidates Chouette::StopArea.where( :area_type => ['Quay', 'BoardingPosition']) end def remove_dependent_journey_pattern_stop_points route.journey_patterns.each do |jp| if jp.stop_point_ids.include?( id) jp.stop_point_ids = jp.stop_point_ids - [id] end end end end
Version data entries
8 entries across 8 versions & 1 rubygems