master
E. Almqvist 3 years ago
parent c8878357b2
commit 0834876425
  1. 5
      wesweb01/crud-music-2020/app.rb

@ -17,12 +17,9 @@ require "sqlite3"
#6. Skapa funktionalitet för att uppdatera artistinformation
db = SQLite3::Database.new("db/chinook-crud.db")
db.results_as_hash = true
get "/" do
slim(:start)
end
@ -37,7 +34,7 @@ get "/albums/:id" do
id = params[:id].to_i
result = db.execute("SELECT * FROM albums WHERE ArtistId = ?", id).first
artist = db.execute("SELECT Name FROM artists WHERE ArtistId IN (SELECT ArtistId FROM Albums WHERE AlbumId = ?)", id).first
slim(:"albums/show",locals: {result: result, artist: artist})
slim(:"albums/show", locals: {result: result, artist: artist})
end

Loading…
Cancel
Save