mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
20 lines
521 B
Ruby
20 lines
521 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_to :back
|
|
end
|
|
end
|
|
end
|
|
end
|