Skip to content
Phil Myers edited this page Jan 24, 2016 · 7 revisions

FAQs - Course 2: Module 3

If you have have a general question that is not specific to the Module 1 content, it may have already been answered here.

Table of Contents

Requirements


Q: rq06 implement redirection is failing?

A: A common mistake is to instead use the following code, which won't work:

redirect_to @todo_item

To figure out the right answer, take note of the hint from the directions:

Hint: you are changing the URI redirected by the controller’s create method. Use rake routes to help determine the appropriate helper_method_prefix, URI, and controller#method mappings. Append _url to the helper method prefix when implementing this redirection.

Q: Difference between persisted and new_record?

A:

persisted?

Returns true if the record is persisted, i.e. it’s not a new record and it was not destroyed, otherwise returns false.

new_record?

Returns true if this object hasn’t been saved yet – that is, a record for the object doesn’t exist in the database yet; otherwise, returns false.

More documentation can be found at the following links:

http://apidock.com/rails/ActiveRecord/Persistence/persisted%3F

http://apidock.com/rails/ActiveRecord/Persistence/new_record%3F

Q: Display completed TodoItems is failing?

A: Make sure you return the number of completed TodoItems. You will need to use a where clause to do this.

Clone this wiki locally