internetee-registry/app/controllers/admin/zonefiles_controller.rb
Alex Sherman 8cc42cb170 Fix redirect back
Closes #1535
2020-02-28 13:55:01 +05:00

20 lines
547 B
Ruby

module Admin
class ZonefilesController < BaseController
authorize_resource class: false
# TODO: Refactor this
def create
if ::DNS::Zone.origins.include?(params[:origin])
@zonefile = ActiveRecord::Base.connection.execute(
"select generate_zonefile('#{params[:origin]}')"
)[0]['generate_zonefile']
send_data @zonefile, filename: "#{params[:origin]}.txt"
else
flash[:alert] = 'Origin not supported'
redirect_back(fallback_location: root_path)
end
end
end
end