Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Conversation

@Dolu89
Copy link
Contributor

@Dolu89 Dolu89 commented Jun 30, 2020

Proposed changes

It should be added because edge template receive 'true' or 'false' as value when doing this :
Controller.ts

const myObjectWithBoolean = await MyObjectWithBoolean.query()....firstOrFail() //{myBoolean: true}
return view.render('myView', {...myObjectWithBoolean.toJSON()})

view.edge
<p>{{myBoolean}}</p> => display 'true', not 1, '1' or 'on'

eg.

<div x-data="{ showMessage: {{show_message}} }">
  <input type="checkbox" x-model="showMessage">
  <input type="hidden" name="showMessage" :value="showMessage">
</div>

Types of changes

What types of changes does your code introduce?

Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

Further comments

/

@thetutlage thetutlage merged commit 86f5486 into adonisjs:develop Jul 1, 2020
@thetutlage
Copy link
Member

Thanks for it. Before I publish it, can you please also create another PR for the docs? https://github.com/adonisjs/adonisjs.com/blob/develop/docs/docs/guides/03-validator/03-data-types.md

@Dolu89 Dolu89 deleted the feature-86-boolean branch July 1, 2020 11:32
@Dolu89
Copy link
Contributor Author

Dolu89 commented Jul 1, 2020

Thanks for it. Before I publish it, can you please also create another PR for the docs? https://github.com/adonisjs/adonisjs.com/blob/develop/docs/docs/guides/03-validator/03-data-types.md

I don't understand, there is already 'true' and 'false' in the list

"1", 1, "on", "true" is casted to true.
"0", 0, "off", "false" is casted to false.

@thetutlage
Copy link
Member

Ohh okay. Ignore it then 🙂

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants