Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialElizabeth Hahn
21,034 PointsWhy does @Model.Favorite render as false the first time it is ran? I mean, is false the default?
Also, once the code is changed to @(Model.favorite ? "yes" : "no") it renders to "no", which I get because because before it rendered to "false" before. But the new layout code from our "designer" is suppose to be "yes" So what exactly is setting this to false the first run and no the second time, and why does it not expressed properly what the designers want? Here is the markup from the designer: <h5><label>Favorite:</label> Yes</h5>
2 Answers
Steven Parker
231,198 PointsThe field's value is false, and the new code converts it to the word "No". This seems exactly as it should be to me.
So why do you say that it 'is suppose to be "yes"'?
Elizabeth Hahn
21,034 PointsBecause the mark up from the "designers" in the teachers notes has this: <h5><label>Favorite:</label> Yes</h>. I took this to mean that the comic book is indeed a favorite.
Steven Parker
231,198 PointsGood point, but the fault would be in the data, not the code. In fact, I don't see where a "Favorite" property was added to issue 700 at all. Perhaps a missing property just reads as "false" instead of causing an error.
In any case, you might want to make a bug report to the Support staff.