Display all tags 4/9


It says there: "add the index action to display a list of all tags. To do this, fetch all tags from the database and store them in variable @tags."

So it has to be in that file 'routes.rb' as well.
Possibly I have to map something, just like we have done it before with 'tags'? Or add something to the 'index' method. I have completed the complete Ruby course but Ruby on rails seems to be quite different. Have to get used to it. Here's the code. Can someone help and give me a hint please? Thanks!
get '/tags' => 'tags#index'
def index
@tags = Tag.all


Hi Daniel,

You have two separate files you need to work in:

  1. config/routes.rb
  2. app/controllers/tags_controller.rb (I think that's it's name)

The first line of your code is fine, and belongs in config/routes.rb. The last three lines are also fine, but they belong in file #2 (app/controllers/tags_controller.rb).

Please let me know if you run into any more trouble :slightly_smiling:


Thanks man! Great that its now on the forum so other people can see it


Um... I tried the first line of his kosmotakis' code in routes.rb and got an error. can you help?


@jwdean26 Sure :slight_smile:

Please create a new topic with your code, the error message you're getting, and a link to the exercise you're on.