Created
September 1, 2011 17:52
-
-
Save jbynum/1186774 to your computer and use it in GitHub Desktop.
search for bands by gener
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
def location | |
@genre = Genre.find_by_slug(params[:slug]) | |
if @genre.nil? | |
render :template => 'site/not_found', :status => '404' | |
end | |
@title = "#{params[:city] + ',' if params[:city]} #{params[:state]} #{@genre.name}" | |
@results = [] | |
@bands = Band.near( | |
[params[:city], params[:state]].join(" "), | |
3000, | |
:order => :distance | |
).reject { |x| x.will_travel == false && x.distance.to_i >= 50} | |
@bands.each do |band| | |
if band.genres.include?(@genre) | |
@results << band | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment