MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.


I'm not curious

Rails Routes and Resources

Course Summary

You've seen how to create a Rails resource using a scaffold. But scaffolds don't offer flexibility in how a resource is set up. Let's create a resource totally by hand to see how it's put together. Along the way, we'll learn another important component of Rails: routes.


  • +

    Course Syllabus

    A Route to an Index Action

    In the first stage, we'll read all Page records in the database and display their titles in a list. (Since we won't yet have a form for adding Pages, we'll have to add some via the Rails console.) This first stage will be the most involved, since we'll need to set up a route, a controller, a view, AND a model for our Pages. 14 steps
    • Introduction 2:03
    • Creating a Route 4:45
    • Creating a Route 4 questions
    • Viewing Routes 1 objective
    • Adding a Route 1 objective
    • Creating a Controller 2:39
    • Creating a Controller 1 objective
    • Creating a View 1:29
    • Creating a View 1 question
    • Creating a Model 3:32
    • Creating a Model 1 objective
    • Adding Records via Rails Console 3:17
    • Populating the View 8:57
    • Populating the View 2 objectives

    A Route to a Read Action

    Users can view a list of all our page titles, but they can't view the content of single Pages yet. For our Posts resource, they can click a link on the list of all Posts to view an individual post. Let's set up links to view single Pages as well. 9 steps

    Routes to Create Actions

    Our users can view a list of all Pages. They can click a link to view an individual Page. What they CAN'T do right now is create new pages; we had to go into the Rails console to do that. Our next task is to set up a form so that it's easy for our USERS to create Pages, too. 10 steps

    Routes to Update Actions

    Now our users can create a new Page. But they'd better get it right the first time, because right now they can't go back and change what they've entered.Maybe we should fix that. Let's give them a form to allow them to update existing Pages. 6 steps

    A Route to a Delete Action

    For every resource you create, there may come a time when you don't want it any more. So, let's allow our users to delete Pages. 6 steps


Course Fee:
USD 25

Course Type:

Self-Study

Course Status:

Active

Workload:

1 - 4 hours / week

Attended this course?

Back to Top

Awards & Accolades for MyTechLogy
Winner of
REDHERRING
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url

Back to Top