4. Display a tag


#1

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?


#2

Hi,

This point was in the lesson before:
https://www.codecademy.com/en/courses/learn-rails/lessons/start/exercises/start-routes

This syntax worked for me:

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

#3

@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.


#4

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>
</div>
  <% end %>

#5

just use "rake db:migrate" command and everything will be okay :slightly_smiling:


#6

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


<%= image_tag d.image %>

<%= d.title %>



<% end %>

#7

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.
CODE:

Rails.application.routes.draw do

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

P.S. Doesn't work with end either


#8

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