internetee-registry/app/controllers/admin/zonefiles_controller.rb
Martin Lensment a88109021e Rubocop fix
2014-11-26 15:18:41 +02:00

20 lines
524 B
Ruby

class Admin::ZonefilesController < ApplicationController
# TODO: Refactor this
# rubocop:disable Metrics/MethodLength
def index
end
def create
if ZonefileSetting.pluck(:origin).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