Skip to content

Instantly share code, notes, and snippets.

@levinotik
Created November 9, 2011 18:44
Show Gist options
  • Save levinotik/1352467 to your computer and use it in GitHub Desktop.
Save levinotik/1352467 to your computer and use it in GitHub Desktop.
class ArtistSearchController < ApplicationController
def search
@title = "Search"
end
def artist
@title = "Similar artists"
logger.debug "#{params[:artist].class}"
unless params.nil?
musicRequest = MusicRequest.new
data = musicRequest.find_similar(params[:artist])
names = []
data[:response][:artists].each do |artist|
names << artist[:name]
end
@similarArtists = names
logger.debug "#{data}"
end
end
def list_similar
@title = "amazing"
end
end
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
</head>
<body>
<h1>Similar artists</h1>
<p>
Here's a list of similar artists
</p>
<ul>
<%= @similarArtists.each do |artist| %>
<li>
<%= artist %>
</li>
<% end %>
</ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment