bus/config/routes.rb

35 lines
972 B
Ruby
Raw Normal View History

2021-08-04 03:11:10 +00:00
if File.basename($0) != 'rake'
Thread.new do
update_route_interval = RulingBusSetting.first.update_route_interval
while 1
puts ['update_bus_info_tasks',"interval: #{update_route_interval}min"]
RulingBusInfo.all.each do |bus_info|
bus_info.regenerate_cache_data
end
sleep (update_route_interval.minutes)
end
end
end
Rails.application.routes.draw do
locales = Site.first.in_use_locales rescue I18n.available_locales
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
namespace :admin do
resources :ruling_buses do
member do
get "edit_bus"
post "update_bus"
post "update_setting"
end
collection do
post "get_stops_and_code_for_city"
post "route_name_for_targets"
get "setting"
get "new_bus"
post "create_bus"
end
end
end
get "/xhr/get_bus" => "ruling_buses#get_bus"
end
end