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