-
Notifications
You must be signed in to change notification settings - Fork 43
Amy Cash - Pipes - TaskList #41
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
base: master
Are you sure you want to change the base?
Conversation
Task ListWhat We're Looking For
|
| @task = Task.find(params[:id]) | ||
| @task.date = Date.today | ||
| @task.title = @task.title.upcase! | ||
| @task.save |
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.
Line 36, @task.title = @task.title.upcase!, will un-set the task's title when it's marked incomplete! Turns out Ruby's string upcase! method returns nil if no changes were made.
Because you're using the "bang" version, it does change @task.title, but then you set @task.title to the return value (nil if it's already upcase).
The fix here is to use one or the other, but not both:
@task.title = @task.title.upcase
# - OR -
@task.title.upcase!FWIW, this was a very surprising fact to me. I would not have designed upcase! this way.
Task List
Congratulations! You're submitting your assignment!
Comprehension Questions