render error when people attempt to save an invalid group name

hide controls when we showing an automatic group
This commit is contained in:
Sam
2013-06-17 13:43:06 +10:00
parent b97d186cb5
commit 0052e78bfe
5 changed files with 30 additions and 11 deletions

View File

@ -20,9 +20,12 @@ class Admin::GroupsController < Admin::AdminController
can_not_modify_automatic
else
group.usernames = params[:group][:usernames]
group.name = params[:group][:name] if params[:name]
group.save!
render json: "ok"
group.name = params[:group][:name] if params[:group][:name]
if group.save
render json: "ok"
else
render_json_error group
end
end
end