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 trialBruce Whealton
3,619 PointsWhat does the error mean in Challenge 3 of 4, where it says "I don't see a Ruby Boolean?"
This is from the first Database course in the python series. I am in the queries.py file and it seems to know about the file that would hold the actual Model for the database. We are asked to add one record to the database. Following from the previous work we've done, I setup a dictionary to do this.
I did notice that in the code we are developing in this course, we have an add_students function. In the try block there is no save() method. I thought that add_students() would need a commit statement. I can assume that this is happening automatically. I'll try avoiding the dictionary and just hard code the values for the create statement. Or am I missing something? Thanks, Bruce
from models import Challenge
all_challenges = Challenge.select()
challenges = [
{'language': 'Ruby',
'name': 'Booleans'},
]
def add_challenges():
for challenge in challenges:
Challenge.create(language=challenge['language'],
name=challenge['name'])
3 Answers
Chris Freeman
Treehouse Moderator 68,441 PointsTask 3 of the First Queries challenge asks: "Next, create a new Challenge. The language should be "Ruby", the name should be "Booleans".
You don't need to create a function for this, you can simply enter:
Challenge.create(language="Ruby", name='Booleans')
Or call your function using
add_challenges()
Innocent Ngwaru
7,554 Pointsmy code won't pass, I dont know why?
from models import Challenge
all_challenges = Challenge.select()
Challenge.create(language="Ruby",name=student"Booleans")
[MOD: added ```python formatting -cf]
Chris Freeman
Treehouse Moderator 68,441 PointsThe word student
should be removed: Challenge.create(language="Ruby", name="Booleans")
Innocent Ngwaru
7,554 Pointsoh I see thank you so much
James N
17,864 PointsJames N
17,864 Pointsthanks for the help! BTW i've seen you in many other forum posts, you are a good coder.
shaRON CAMERON
1,641 PointsshaRON CAMERON
1,641 Pointsthank so much!