-
Generate URLs using route helpers
-
Draw routes with implicit and explicit names using
:as
-
Draw routes with variables
-
Generate URLs using route helpers that require variables
In this lab you will be building out the Student management dashboard for the Flatiron School by starting to integrate the ability to link between pages. Four tests are currently passing and the rest need implementation code to start passing. In order to complete this lab you will need to complete the following tasks:
-
A user should be able to navigate to
/students
to view all of the students -
A user should be able to click the student's name on the
index
page and be taken to that specific student'sshow
page -
Students now have a new boolean attribute called
active
(HINT: You might have to search around for the best way to set a (ahem) default value.) -
A user should be able to go to
/student/:id/activate
and theiractive
attribute toggled totrue
orfalse
-
Make sure the show path is
/student/:id
where the:id
is a route variable -
Call our Student class instance method
to_s
on each of students on the index page so that each student element contains their first and last name. -
On the student index page, test out all three different link_to argument options, e.g.:
link_to "post", "/post/#{post.id}"
,link_to("post", post_path(post.id))
,link_to("post", post_path(post))
.
View Rails URL Helpers Lab on Learn.co and start learning to code for free.
View Rails URL Helpers Lab on Learn.co and start learning to code for free.