Domain editing

This commit is contained in:
Martin Lensment 2014-09-15 11:44:26 +03:00
parent 2a4c46e870
commit 4c4edd3747
6 changed files with 56 additions and 34 deletions

View file

@ -1,5 +1,5 @@
class Admin::DomainsController < ApplicationController
before_action :set_domain, only: [:show]
before_action :set_domain, only: [:show, :edit, :update]
def new
@domain = Domain.new
@ -28,6 +28,19 @@ class Admin::DomainsController < ApplicationController
@domain.all_dependencies_valid?
end
def edit
params[:registrar] = @domain.registrar
params[:owner_contact] = @domain.owner_contact_code
end
def update
if @domain.update(domain_params)
redirect_to [:admin, @domain]
else
render 'edit'
end
end
private
def set_domain