Skip to content

Conversation

@cashmonger
Copy link

Task List

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe in your own words what the Model is doing in Rails The model stores and retrieves data from a database. It's a Ruby class, with the database column names as the attributes.
Describe in your own words what the Controller is doing in Rails The controller is handling all of the methods for your application. It can use methods that are built into rails, or methods that you write yourself.
Describe in your own words what the View is doing in Rails The view is responsible for displaying data to the users. ERB is used to get/organize data from the model, and that data is used to populate the HTML template.
What is the purpose of using strong params? (i.e. the params method in the controller)
How are Rails migrations related to Rails models? Rails migrations are how you create/alter the structure of your database. It's how you assign attribute names/datatypes that will be used with each record you create later.
Describe one area of Rails that are still unclear on How to change things without forms. I somehow missed that we were supposed to do a mark complete button, and, as I tried to add one in, I realized that I'm not sure how to work with data when it's not in a form.

@droberts-sea
Copy link

Task List

What We're Looking For

Feature Feedback
Baseline
Appropriate Git Usage with no extraneous files checked in yes
Answered comprehension questions yes
Successfully handles: Index, Show yes
Successfully handles: New, Create yes
Successfully handles: Edit, Update yes
Successfully handles: Destroy, Task Complete yes - there's a bug with incomplete - see inline comment
Routes follow RESTful conventions yes
Uses named routes (like _path) yes
Overall Good work overall!

@task = Task.find(params[:id])
@task.date = Date.today
@task.title = @task.title.upcase!
@task.save

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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants