Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 7352477

Browse files
committed
Merge pull request #190 from transitland/changeset-callbacks
route changeset callbacks conflicting
2 parents 49488c5 + 72613d0 commit 7352477

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

app/models/route.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,16 @@ def csv_row_values
6666
kind_of_model_tracked: :onestop_entity,
6767
virtual_attributes: [:serves, :does_not_serve, :operated_by, :identified_by, :not_identified_by, :imported_from_feed_onestop_id]
6868
})
69+
70+
# FIXME: this is a temporary fix to run both the following `before_create_making_history` changeset
71+
# callback as well as the callback of the same name that is included from IsAnEntityWithIdentifiers
72+
class << Route
73+
alias_method :existing_before_create_making_history, :before_create_making_history
74+
end
6975
def self.before_create_making_history(new_model, changeset)
7076
operator = Operator.find_by_onestop_id!(new_model.operated_by)
7177
new_model.operator = operator
72-
super(new_model, changeset)
78+
self.existing_before_create_making_history(new_model, changeset)
7379
end
7480
def self.after_create_making_history(created_model, changeset)
7581
OperatorRouteStopRelationship.manage_multiple(

spec/services/gtfsgraph_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def load_feed(import_level=1)
4646
expect(r).to be_truthy
4747
expect(r.name).to eq('Bullet')
4848
expect(r.onestop_id).to eq('r-9q9j-bullet')
49-
# expect(r.identifiers).to match_array(["gtfs://f-9q9-caltrain/r/bullet"])
49+
expect(r.identifiers).to match_array(["gtfs://f-9q9-caltrain/r/Bu-121"])
5050
expect(r.tags['vehicle_type']).to eq('rail')
5151
expect(r.tags['route_long_name']).to eq('Bullet')
5252
expect(r.geometry).to be

0 commit comments

Comments
 (0)