Class: AliasesController
Instance Method Summary
collapse
#after_sign_in_path_for, #any_admin_user_exists?, #first_admin_user_action?
Instance Method Details
#create ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/controllers/aliases_controller.rb', line 15
def create
@domain = current_admin_user.domain(params[:domain_id])
@alias = @domain.virtual_aliases.build(params[:virtual_alias])
if @alias.save
render :json => {:id => @alias.id}
else
render :json => {:errors => @alias.errors}
end
rescue
render :json => {:errors => t('unknown_error')}
end
|
#destroy ⇒ Object
27
28
29
30
31
32
|
# File 'app/controllers/aliases_controller.rb', line 27
def destroy
@alias.destroy
render :json => {:id => nil}
rescue
render :json => {:errors => t('unknown_error')}
end
|
#update ⇒ Object
5
6
7
8
9
10
11
12
13
|
# File 'app/controllers/aliases_controller.rb', line 5
def update
if @alias.update_attributes(params[:virtual_alias])
render :json => {:id => @alias.id}
else
render :json => {:errors => @alias.errors}
end
rescue
render :json => {:errors => t('unknown_error')}
end
|