Skip to content

Latest commit

 

History

History
55 lines (47 loc) · 973 Bytes

routes-views-controllers-matthew-nate.md

File metadata and controls

55 lines (47 loc) · 973 Bytes

home_controller.rb

class HomeController < ApplicationController
    def greeter
        
    end

    def pharaoh
        @pharaoh = 'Come and meet the Kings of Egypt!'
        @kings = ['Matthew', 'Nate']
    end
end

pharaoh.html.erb

<h3>Hello!</h3>
<p> <%= @pharaoh %> </p>
<ul>
    <% @kings.each do |king| %>
    <% end %>
    <li><%= link_to 'Matthew', '/matthew' %></li>
    <li><%= link_to 'Nate', '/nate' %></li>
</ul>

matthew.html.erb

About King Matthew

  • Snowboarding
  • Traveling
  • Concerts/Festivals

nate.html.erb

About King Nate

  • Chargers Football
  • Gaming
  • Pizza

routes.rb

Rails.application.routes.draw do

  get '/greeter' => 'home#greeter'
  # root to: 'home#greeter'

  get '/pharaoh' => 'home#pharaoh'
  root to: 'home#pharaoh'

  get '/matthew' => 'home#matthew'

  get '/nate' => 'home#nate'
end