mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 03:30:33 +02:00
Merge branch 'improve-registrar' into registry-267
# Conflicts: # db/schema-read-only.rb # db/structure.sql
This commit is contained in:
commit
5c6a0034f6
15 changed files with 316 additions and 22 deletions
|
@ -17,10 +17,15 @@ class Admin::RegistrarsController < AdminController
|
|||
def create
|
||||
@registrar = Registrar.new(registrar_params)
|
||||
|
||||
if @registrar.save
|
||||
begin
|
||||
@registrar.transaction do
|
||||
@registrar.save!
|
||||
@registrar.accounts.create!(account_type: Account::CASH, currency: 'EUR')
|
||||
end
|
||||
|
||||
flash[:notice] = I18n.t('registrar_added')
|
||||
redirect_to [:admin, @registrar]
|
||||
else
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
flash.now[:alert] = I18n.t('failed_to_add_registrar')
|
||||
render 'new'
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue