Files
growstuff/app/controllers/places_controller.rb
Daniel O'Connor ed87d23ece Merge pull request #4560 from Growstuff/fix-i18n-locale-texts-16171345716630423189
Fix Rails/I18nLocaleTexts RuboCop errors
2026-04-26 13:36:10 +09:30

42 lines
1.1 KiB
Ruby

# frozen_string_literal: true
class PlacesController < ApplicationController
skip_authorize_resource
respond_to :html, :json
def index
respond_to do |format|
format.html
# json response is whatever we want to map here
format.json do
render json: Member.located.to_json(only: %i(
id login_name slug location latitude longitude
))
end
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 do
render json: @nearby_members.to_json(only: %i(
id login_name slug location latitude longitude
))
end
end
end
def search
if params[:new_place].empty?
redirect_to places_path, alert: t('messages.invalid_location')
else
redirect_to place_path(params[:new_place])
end
end
end