Skip to content

Instantly share code, notes, and snippets.

@phensalves
Created January 6, 2017 15:13
Show Gist options
  • Save phensalves/76b5b3e5e57d1d213a4374adde0fffd5 to your computer and use it in GitHub Desktop.
Save phensalves/76b5b3e5e57d1d213a4374adde0fffd5 to your computer and use it in GitHub Desktop.
def list_favorite_bars bar_id
@favorite_bars = get_favorite_bars(params[:bar_id])
respond_to do |format|
format.json { render :json => @favorite_bars}
end
end
private
def get_favorite_bars bar_id
Bar.select([:name, :short_description, :star_rating, :price_rating]).where("latitude IS NOT NULL AND longitude IS NOT NULL").find_all_by_id(bar_id)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment