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

Add a style guide to suggest to pass a string literal as a URL to http method calls #359

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1921,6 +1921,23 @@ travel_to(Time.current.to_time)
freeze_time
----

=== HTTP URL [[http-url]]

Prefer passing a string literal as a URL to HTTP methods to make the actual URL obvious and to facilitate tracking endpoint path changes.

[source,ruby]
----
# bad
get photos_path
put photo_path(id)
post edit_photo_path(id)

# good
get "/photos"
put "/photos/#{id}"
post "/photos/#{id}/edit"
----

== Managing Processes

=== Foreman [[foreman]]
Expand Down