Closed grosch closed 6 years ago
@grosch I'm gonna guess that client.points_per_month
works - the coding keys will affect the data going into Leaf as well since they all rely on Codable
@0xTim Ugh! That's what the issue was. That's horrible though. The coding keys are supposed to make the database work, but the whole res of the project should use the variables as defined by Swift. Very confusing to have everything use the pascal case names, and then the leaf file only use the snake case.
Well everything that uses Swift will use how they are defined in the Swift. But Leaf needs to convert the data into something it can understand so it uses Codable
for that - it will be the same for JSON. If you are returning JSON you'll get the snake_case
keys
Closing since this is related to Codable itself.
I'm having an issue with data not appearing on the HTML page and was pointed here. I've got an
Order
class that defines a bunch of properties, and uses CodingKeys to modify the names in the database:and then on my controller I've got a simple method to show all the elements:
When I run the app and load the page I see the expected value for
pointsPerMonth
printed out in Xcode's console from theprint
statement. However, there's no value in the HTML. The .leaf file just uses a simple table to show the data:The first, second, and last
<td>
elements have data. Everything else is blank.