You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/source/api_documentation_guidelines.md
+10-16Lines changed: 10 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -401,29 +401,23 @@ user-facing API documentation.)
401
401
Regarding the Rails Stack
402
402
-------------------------
403
403
404
-
When documenting parts of Rails API, it's important to remember all of the
405
-
pieces that go into the Rails stack.
404
+
When documenting parts of Rails' API, it's important to be mindful of the entire
405
+
Rails stack. Behavior of the method or class you're documenting may change
406
+
depending on context.
406
407
407
-
This means that behavior may change depending on the scope or context of the
408
-
method or class you're trying to document.
409
-
410
-
In various places there is different behavior when you take the entire stack
411
-
into account, one such example is
412
-
`ActionView::Helpers::AssetTagHelper#image_tag`:
408
+
One such example is `ActionView::Helpers::AssetTagHelper#image_tag`:
413
409
414
410
```ruby
415
411
# image_tag("icon.png")
416
412
# # => <img src="/assets/icon.png" />
417
413
```
418
414
419
-
Although the default behavior for `#image_tag` is to always return
420
-
`/images/icon.png`, we take into account the full Rails stack (including the
421
-
Asset Pipeline) we may see the result seen above.
422
-
423
-
We're only concerned with the behavior experienced when using the full default
424
-
Rails stack.
415
+
In isolation, `image_tag` would return `/images/icon.png`. However, when we take
416
+
into account the full Rails stack, including the Asset Pipeline, we may see the
417
+
above result.
425
418
426
-
In this case, we want to document the behavior of the _framework_, and not just
427
-
this specific method.
419
+
We want to document the behavior of the _framework_, not just isolated methods.
420
+
Our concern is the behavior that the user experiences when using the full
421
+
default Rails stack.
428
422
429
423
If you have a question on how the Rails team handles certain API, don't hesitate to open a ticket or send a patch to the [issue tracker](https://github.com/rails/rails/issues).
0 commit comments