How to "create a route that maps the URL /messages to the Messages controller's index action"?


#1

2.
In the routes file, create a route that maps the URL /messages to the Messages controller's index action.

How do I even do this?

Thank you.


#2

Hi Jonas,

Open the routes file (located at config/routes.rb), then follow the instructions. Here's the syntax for a route:

get '/url' => 'controller#action'

#3

Hello zystvan

The instructions are:
In the routes file, create a route that maps the URL /messages to the Messages controller's index action.

I now know where the routes file are.

What are the URL?

I tried '/messages' but receive this error:
A route matches "/messages", but references missing controller: ControllerController

Thank you in advance.
Jonas


#4

@jonas.preislergmail

A route matches "/messages", but references missing controller: ControllerController

It sounds to me like you need to create the Messages controller. Try going to the first exercise in this lesson, and restarting from there (you can restart from the Get Help menu in the lower-right).


#5

OK I will try again.


#6

Check out this link, worked for me!


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.