-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Include examples of implicit request in Action documentation #7871
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
Conversation
marcospereira
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Shruti9520 see the comments.
| @@ -29,6 +29,18 @@ It is often useful to mark the `request` parameter as `implicit` so it can be im | |||
|
|
|||
| @[implicit-request-action](code/ScalaActions.scala) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actions using implicit requests are already documented here, at this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Git
|
|
||
| @[some-csrf-action-with-more-methods](../forms/code/ScalaCsrfController.scala) | ||
|
|
||
| The last way of creating an Action value is to specify an additional `BodyParser` argument: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flow is now kind of weird. We have examples for:
- Simple actions without arguments
- Actions that accept the request as a parameter, but not implicitly
- A new section (with titles) for actions accepting an
implicitrequest - And then (here is where I think the flow is broken), under the "Passing an implicit request between methods" we have an example using a specific body parser.
It would be better to not have another section but instead just a new example in ScalaActions.scala explaining how to use the implicit request in other methods or views.
Finally, it is preferable to add the example in ScalaActions.scala file (linked above) instead of reusing the CSRF examples here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
Thank you for reviewing. :)
|
As @wsargent mentioned on the issue we should add references to the following pages:
|
|
Hi, @gmethvin
Also, I am little confused about introducing Thanks! |
| } | ||
|
|
||
| "pass the request implicitly to the action with more methods" in { | ||
| //#implicit-request-action-with-more-methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pay attention to the code format/style. We use two spaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry for this. I'll take care of it next time onwards.
Thanks :)
|
@marcospereira I have made necessary changes. Thanks for the feedback. :-) |
|
Hi, as indicated by @marcospereira example with implicit request are alread present in |
|
Hi @cchantep, I documented Thanks again. :) |
|
Backport to 2.6.x: 46372a6 |
Fixes #6573