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
@@ -358,29 +358,23 @@ user-facing API documentation.)
358
358
Regarding the Rails Stack
359
359
-------------------------
360
360
361
-
When documenting parts of Rails API, it's important to remember all of the
362
-
pieces that go into the Rails stack.
361
+
When documenting parts of Rails' API, it's important to be mindful of the entire
362
+
Rails stack. Behavior of the method or class you're documenting may change
363
+
depending on context.
363
364
364
-
This means that behavior may change depending on the scope or context of the
365
-
method or class you're trying to document.
366
-
367
-
In various places there is different behavior when you take the entire stack
368
-
into account, one such example is
369
-
`ActionView::Helpers::AssetTagHelper#image_tag`:
365
+
One such example is `ActionView::Helpers::AssetTagHelper#image_tag`:
370
366
371
367
```ruby
372
368
# image_tag("icon.png")
373
369
# # => <img src="/assets/icon.png" />
374
370
```
375
371
376
-
Although the default behavior for `#image_tag` is to always return
377
-
`/images/icon.png`, we take into account the full Rails stack (including the
378
-
Asset Pipeline) we may see the result seen above.
379
-
380
-
We're only concerned with the behavior experienced when using the full default
381
-
Rails stack.
372
+
In isolation, `image_tag` would return `/images/icon.png`. However, when we take
373
+
into account the full Rails stack, including the Asset Pipeline, we may see the
374
+
above result.
382
375
383
-
In this case, we want to document the behavior of the _framework_, and not just
384
-
this specific method.
376
+
We want to document the behavior of the _framework_, not just isolated methods.
377
+
Our concern is the behavior that the user experiences when using the full
378
+
default Rails stack.
385
379
386
380
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