Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only invoke route.source_location if available #489

Merged
merged 1 commit into from
Oct 23, 2024

Conversation

vinistock
Copy link
Member

@vinistock vinistock commented Oct 22, 2024

Closes #492

Fix for #488

Since the Rails add-on is installed by default, while we don't aim to have every feature work on EOL versions of Rails, we still need to ensure we don't break. The source_location method only exists after 7.0.

It would be nice to generalize a solution for handling which features are available based on Rails version. Rather than checking with respond_to? on the server side every time, we can avoid the request to the server completely if we keep some sort of feature dictionary. Something like

SERVER_FEATURE_VERSIONS = {
  route_locations: "7.1",
  some_other_thing: "8.0",
}

@vinistock vinistock added the bugfix This PR fixes an existing bug label Oct 22, 2024
@vinistock vinistock self-assigned this Oct 22, 2024
@vinistock vinistock requested a review from a team as a code owner October 22, 2024 14:35
@vinistock vinistock merged commit 334b0e7 into main Oct 23, 2024
28 checks passed
@vinistock vinistock deleted the vs-fix-missing-source-location branch October 23, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR fixes an existing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Undefined method source_location for ActionDispatch::Journey::Route with Rails 6.1
2 participants