internetee-registry/app/controllers/admin/zonefiles_controller.rb
Artur Beljajev bff7437277 Refactor zones
- Rename "zonefile_setting" to "zone"
- Remove version

#475
2017-04-20 17:20:36 +03:00

18 lines
486 B
Ruby

class Admin::ZonefilesController < ApplicationController
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