mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-01-15 21:07:52 -05:00
32 lines
849 B
Ruby
32 lines
849 B
Ruby
class PlacesController < ApplicationController
|
|
skip_authorize_resource
|
|
|
|
def index
|
|
respond_to do |format|
|
|
format.html
|
|
# json response is whatever we want to map here
|
|
format.json { render :json => Member.located.to_json(:only => [:id, :login_name, :slug, :location, :latitude, :longitude]) }
|
|
end
|
|
end
|
|
|
|
# GET /places/london
|
|
# GET /places/london.json
|
|
def show
|
|
@place = params[:place] # used for page title
|
|
@nearby_members = Member.nearest_to(params[:place])
|
|
respond_to do |format|
|
|
format.html # show.html.haml
|
|
format.json { render :json => @nearby_members.to_json(:only => [:id, :login_name, :slug, :location, :latitude, :longitude]) }
|
|
end
|
|
end
|
|
|
|
def search
|
|
respond_to do |format|
|
|
format.html do
|
|
redirect_to place_path(params[:new_place])
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|