Created
May 28, 2021 18:53
-
-
Save nvandoorn/48315fce2fccf120da808b0d9f10ca47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# songs_controller.rb | |
class SongsController < ApplicationController | |
def index | |
@songs = Song.all | |
end | |
def show | |
@song = Song.find(param[:id]) | |
end | |
def create | |
Song.create(params[:song]) | |
end | |
end | |
# application_controller.rb | |
class ApplicationController < ActionController::Base | |
end | |
# routes.rb | |
Rails.application.routes.draw do | |
resources :songs, only: [:index, :show, :create] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment