mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
32 lines
582 B
Ruby
32 lines
582 B
Ruby
class Admin::DomainsController < ApplicationController
|
|
before_action :set_domain, only: [:show]
|
|
|
|
def new
|
|
@domain = Domain.new
|
|
end
|
|
|
|
def create
|
|
@domain = Domain.new(domain_params)
|
|
|
|
if @domain.save
|
|
redirect_to [:admin, @domain]
|
|
else
|
|
render 'new'
|
|
end
|
|
end
|
|
|
|
def index
|
|
@q = Domain.search(params[:q])
|
|
@domains = @q.result.page(params[:page])
|
|
end
|
|
|
|
private
|
|
|
|
def set_domain
|
|
@domain = Domain.find(params[:id])
|
|
end
|
|
|
|
def domain_params
|
|
params.require(:domain).permit(:name, :period, :registrar_id, :owner_contact_id)
|
|
end
|
|
end
|