4. Display a tag


In the routes file, add a new route that maps requests to /tags to the Tags controller's index action.

What does that even mean? and what's the syntax for it?



This point was in the lesson before:

This syntax worked for me:

Rails.application.routes.draw do
  get '/tags' => 'tags#index'


@mwojtczak is correct.

@jacobjohn, as per mwojtczak's advice, you should start with the beginner lessons before the more advanced ones.

The operation means that when the user calls "https://localhost:8000/tags" in the browser, the routes table will tell the Tags controller to activate its "#index" action, i.e typically listing all instances of something. In this case all tags.


Here is my solution:

<div class="cards row">
<%= @tags.each do |d| %>
  <div class="card col-xs-4">
    <%= image_tag d.image %>
   tag's image goes here
        <h2> tag's title goes here </h2>
  <% end %>


just use “rake db:migrate” command and everything will be okay :slight_smile:


<% @tags.each do |d| %>

<%= image_tag d.image %>

<%= d.title %>

<% end %>


This doesn’t work for ALOT of people. It gives us an error saying "config/application.rb to limit the frameworks that will be loaded.

Rails.application.routes.draw do

get '/tags' => 'tags#index'

P.S. Doesn’t work with end either


Nevermind like asdetmin96 said you just have to run rake db:migrate :slight_smile: