Skip to content

Instantly share code, notes, and snippets.

@travisdmathis
Last active August 29, 2015 14:14
Show Gist options
  • Save travisdmathis/8d9f19291d3fc0bc4fa5 to your computer and use it in GitHub Desktop.
Save travisdmathis/8d9f19291d3fc0bc4fa5 to your computer and use it in GitHub Desktop.
<% search.results.each do |release| %>
<div class="col-md-3 release">
<% cover_url = Record.get_cover_art(release.title) %>
<%= image_tag cover_url, :class => "coverart" %>
<%= hidden_field_tag "#{release.id}" %>
<h5> <%= release.title %> </h5>
<p> <%= release.label[0] %>, <%= release.label[1] %> </p>
<p> <%= release.year %> - <%= release.country %> </p>
<p> <%= release.catno %> </p>
</div>
<% end %>
Started POST "/stores/search_for_record" for 127.0.0.1 at 2015-01-24 12:11:49 -0500
Processing by StoresController#search_for_record as JS
Parameters: {"utf8"=>"✓", "stores"=>{"artist"=>"Phish", "title"=>"", "catno"=>"", "barcode"=>""}, "commit"=>"Search"}
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 18 LIMIT 1
"c5b5fbd7-9702-3b16-bcd7-5116220ca401"
nil
"Phish"
"The Story Of The Ghost"
"35cce75c-4fde-3fa5-bd9a-d6dbf0da9cb1"
nil
"Phish"
"The White Tape"
"199014bb-9886-3df4-9e19-9ca955ae5c00"
nil
"Phish"
"A Picture Of Nectar"
"f5c7ae16-cee8-345e-9e0a-cc22ce40b769"
"http://archive.org/download/mbid-87228991-544a-4c60-85d1-71e33097beb9/mbid-87228991-544a-4c60-85d1-71e33097beb9-9453331811.jpg"
"Phish"
"Junta"
"35cce75c-4fde-3fa5-bd9a-d6dbf0da9cb1"
nil
"Phish"
"The White Tape"
"f11dadf8-6631-432e-bf6c-0ccdaf0bf9fd"
nil
"Phish"
"Two Soundchecks"
"98982e44-87af-4126-bfe3-77ef277deab3"
"http://archive.org/download/mbid-6c268c74-7a02-4218-a2a9-d2efe0075b54/mbid-6c268c74-7a02-4218-a2a9-d2efe0075b54-7651185890.jpg"
"Phish"
"Fuego"
"dcc86c28-67f5-30f4-b1c6-1aaf621a99ab"
"http://archive.org/download/mbid-3687a94d-30d7-465b-bb76-83e69fbde310/mbid-3687a94d-30d7-465b-bb76-83e69fbde310-9457701057.jpg"
"Phish"
"Lawn Boy"
"f5c7ae16-cee8-345e-9e0a-cc22ce40b769"
"http://archive.org/download/mbid-87228991-544a-4c60-85d1-71e33097beb9/mbid-87228991-544a-4c60-85d1-71e33097beb9-9453331811.jpg"
"Phish"
"Junta"
"e0c9f2dc-e23a-4b38-b000-4d88d4c4127f"
"http://archive.org/download/mbid-bc6d14ef-c7fa-4910-b0cb-e9c5910d3f0a/mbid-bc6d14ef-c7fa-4910-b0cb-e9c5910d3f0a-9138894438.jpg"
"Phish"
"Party Time"
"4831a0b6-a62c-4995-b01b-29ab2b175aff"
nil
"Phish"
"Joy"
"dcc86c28-67f5-30f4-b1c6-1aaf621a99ab"
"http://archive.org/download/mbid-3687a94d-30d7-465b-bb76-83e69fbde310/mbid-3687a94d-30d7-465b-bb76-83e69fbde310-9457701057.jpg"
"Phish"
"Lawn Boy"
"dcc86c28-67f5-30f4-b1c6-1aaf621a99ab"
"http://archive.org/download/mbid-3687a94d-30d7-465b-bb76-83e69fbde310/mbid-3687a94d-30d7-465b-bb76-83e69fbde310-9457701057.jpg"
"Phish"
"Lawn Boy"
"9778a2aa-34eb-3d0c-8328-32a754b9c6fd"
nil
"Phish"
"Farmhouse"
"f5c7ae16-cee8-345e-9e0a-cc22ce40b769"
"http://archive.org/download/mbid-87228991-544a-4c60-85d1-71e33097beb9/mbid-87228991-544a-4c60-85d1-71e33097beb9-9453331811.jpg"
"Phish"
"Junta"
Rendered stores/_search_results.html.erb (3351.9ms)
Rendered stores/search_for_record.js.erb (3353.3ms)
Completed 500 Internal Server Error in 3784ms
ActionView::Template::Error (undefined method `[]' for nil:NilClass):
6: <% else %>
7: <% search.results.each do |release| %>
8: <div class="col-md-3 release">
9: <%= image_tag Record.get_cover_art(release.title), :class => "coverart" %>
10: <%= hidden_field_tag "#{release.id}" %>
11: <h5> <%= release.title %> </h5>
12: <p> <%= release.label[0] %>, <%= release.label[1] %> </p>
app/models/record.rb:9:in `get_cover_art'
app/views/stores/_search_results.html.erb:9:in `block in _app_views_stores__search_results_html_erb__766828553496209074_70157932801780'
app/views/stores/_search_results.html.erb:7:in `each'
app/views/stores/_search_results.html.erb:7:in `_app_views_stores__search_results_html_erb__766828553496209074_70157932801780'
app/views/stores/search_for_record.js.erb:1:in `_app_views_stores_search_for_record_js_erb___2280576874846375651_70157955039620'
Rendered /Users/travis/.rvm/gems/ruby-2.1.3@rails416/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/rescues/_trace.text.erb (1.1ms)
Rendered /Users/travis/.rvm/gems/ruby-2.1.3@rails416/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb (1.4ms)
Rendered /Users/travis/.rvm/gems/ruby-2.1.3@rails416/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/rescues/template_error.text.erb (15.3ms)
Full Trace
app/models/record.rb:9:in `get_cover_art'
app/views/stores/_search_results.html.erb:9:in `block in _app_views_stores__search_results_html_erb__766828553496209074_70157932801780'
app/views/stores/_search_results.html.erb:7:in `each'
app/views/stores/_search_results.html.erb:7:in `_app_views_stores__search_results_html_erb__766828553496209074_70157932801780'
actionview (4.1.6) lib/action_view/template.rb:145:in `block in render'
activesupport (4.1.6) lib/active_support/notifications.rb:161:in `instrument'
actionview (4.1.6) lib/action_view/template.rb:339:in `instrument'
actionview (4.1.6) lib/action_view/template.rb:143:in `render'
actionview (4.1.6) lib/action_view/renderer/partial_renderer.rb:306:in `render_partial'
actionview (4.1.6) lib/action_view/renderer/partial_renderer.rb:279:in `block in render'
actionview (4.1.6) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (4.1.6) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.1.6) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.1.6) lib/active_support/notifications.rb:159:in `instrument'
actionview (4.1.6) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionview (4.1.6) lib/action_view/renderer/partial_renderer.rb:278:in `render'
actionview (4.1.6) lib/action_view/renderer/renderer.rb:47:in `render_partial'
actionview (4.1.6) lib/action_view/renderer/renderer.rb:21:in `render'
actionview (4.1.6) lib/action_view/helpers/rendering_helper.rb:32:in `render'
app/views/stores/search_for_record.js.erb:1:in `_app_views_stores_search_for_record_js_erb___2280576874846375651_70157955039620'
actionview (4.1.6) lib/action_view/template.rb:145:in `block in render'
activesupport (4.1.6) lib/active_support/notifications.rb:161:in `instrument'
actionview (4.1.6) lib/action_view/template.rb:339:in `instrument'
actionview (4.1.6) lib/action_view/template.rb:143:in `render'
actionview (4.1.6) lib/action_view/renderer/template_renderer.rb:55:in `block (2 levels) in render_template'
actionview (4.1.6) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (4.1.6) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.1.6) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.1.6) lib/active_support/notifications.rb:159:in `instrument'
actionview (4.1.6) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionview (4.1.6) lib/action_view/renderer/template_renderer.rb:54:in `block in render_template'
actionview (4.1.6) lib/action_view/renderer/template_renderer.rb:62:in `render_with_layout'
actionview (4.1.6) lib/action_view/renderer/template_renderer.rb:53:in `render_template'
actionview (4.1.6) lib/action_view/renderer/template_renderer.rb:17:in `render'
actionview (4.1.6) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionview (4.1.6) lib/action_view/renderer/renderer.rb:23:in `render'
actionview (4.1.6) lib/action_view/rendering.rb:99:in `_render_template'
actionpack (4.1.6) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (4.1.6) lib/action_view/rendering.rb:82:in `render_to_body'
actionpack (4.1.6) lib/action_controller/metal/rendering.rb:32:in `render_to_body'
actionpack (4.1.6) lib/action_controller/metal/renderers.rb:32:in `render_to_body'
actionpack (4.1.6) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (4.1.6) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.1.6) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
activesupport (4.1.6) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/Users/travis/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
activesupport (4.1.6) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.1.6) lib/action_controller/metal/instrumentation.rb:41:in `block in render'
actionpack (4.1.6) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
activerecord (4.1.6) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.1.6) lib/action_controller/metal/instrumentation.rb:40:in `render'
actionpack (4.1.6) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (4.1.6) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (4.1.6) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.1.6) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.1.6) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.1.6) lib/active_support/callbacks.rb:113:in `call'
activesupport (4.1.6) lib/active_support/callbacks.rb:113:in `call'
activesupport (4.1.6) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.6) lib/active_support/callbacks.rb:229:in `call'
activesupport (4.1.6) lib/active_support/callbacks.rb:229:in `block in halting'
activesupport (4.1.6) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.6) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.6) lib/active_support/callbacks.rb:86:in `call'
activesupport (4.1.6) lib/active_support/callbacks.rb:86:in `run_callbacks'
actionpack (4.1.6) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.1.6) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.1.6) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.1.6) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.1.6) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.1.6) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.1.6) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.1.6) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.1.6) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.1.6) lib/abstract_controller/base.rb:136:in `process'
actionview (4.1.6) lib/action_view/rendering.rb:30:in `process'
actionpack (4.1.6) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.1.6) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.1.6) lib/action_controller/metal.rb:232:in `block in action'
actionpack (4.1.6) lib/action_dispatch/routing/route_set.rb:82:in `call'
actionpack (4.1.6) lib/action_dispatch/routing/route_set.rb:82:in `dispatch'
actionpack (4.1.6) lib/action_dispatch/routing/route_set.rb:50:in `call'
actionpack (4.1.6) lib/action_dispatch/journey/router.rb:73:in `block in call'
actionpack (4.1.6) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.1.6) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.1.6) lib/action_dispatch/routing/route_set.rb:678:in `call'
omniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'
omniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.2.2) lib/omniauth/builder.rb:59:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:35:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.1.6) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.1.6) lib/action_dispatch/middleware/flash.rb:254:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.1.6) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.1.6) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.1.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
activerecord (4.1.6) lib/active_record/migration.rb:380:in `call'
actionpack (4.1.6) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.1.6) lib/active_support/callbacks.rb:82:in `run_callbacks'
actionpack (4.1.6) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.1.6) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.1.6) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.1.6) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.1.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.1.6) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.6) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.1.6) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.1.6) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.1.6) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.1.6) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.1.6) lib/rails/engine.rb:514:in `call'
railties (4.1.6) lib/rails/application.rb:144:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
/Users/travis/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/Users/travis/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/Users/travis/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
Request parameters
{"utf8"=>"✓",
"stores"=>{"artist"=>"Phish",
"title"=>"",
"catno"=>"",
"barcode"=>""},
"commit"=>"Search"}
Session dump
_csrf_token: "/5wsxEkJ310/UCFwMK9EPui1qoMRFyP+E6TMW7Szdi0="
session_id: "53547500e060fe74a4da60965a51dbca"
user_id: 18
Env dump
GATEWAY_INTERFACE: "CGI/1.1"
HTTP_ACCEPT: "*/*;q=0.5, text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
HTTP_ACCEPT_ENCODING: "gzip, deflate"
HTTP_ACCEPT_LANGUAGE: "en-US,en;q=0.5"
HTTP_CACHE_CONTROL: "no-cache"
HTTP_PRAGMA: "no-cache"
REMOTE_ADDR: "127.0.0.1"
REMOTE_HOST: "127.0.0.1"
SERVER_NAME: "0.0.0.0"
SERVER_PROTOCOL: "HTTP/1.1"
Response headers
None
class << self
def get_cover_art(release_title)
artist, title = release_title.split(" - ")
mbid = MusicBrainz::ReleaseGroup.search(artist, title)
coverart_archive = CoverArt::Client.new
cover = coverart_archive.group(mbid.first[:mbid])
p mbid.first[:mbid]
p cover
p artist
p title
if cover.blank?
cover = 'no_cover_available.png'
else
return cover
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment