Skip to content

Instantly share code, notes, and snippets.

@jbynum
Created September 1, 2011 17:52
Show Gist options
  • Save jbynum/1186774 to your computer and use it in GitHub Desktop.
Save jbynum/1186774 to your computer and use it in GitHub Desktop.
search for bands by gener
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