closes issue #64

This commit is contained in:
nilsding 2015-01-17 19:49:11 +01:00
parent 2c502aeaa4
commit 4a8005b195
1 changed files with 10 additions and 3 deletions

View File

@ -16,8 +16,15 @@ class Ajax::GroupController < ApplicationController
target_user = User.find_by_screen_name(params[:user]) target_user = User.find_by_screen_name(params[:user])
group = Group.create! user: current_user, display_name: params[:name] group = Group.create! user: current_user, display_name: params[:name]
rescue ActiveRecord::RecordInvalid rescue ActiveRecord::RecordInvalid
if params[:name].strip.length > 30
@status = :toolong @status = :toolong
@message = "Group name too long (30 characters max.)" @message = "Group name too long (30 characters max.)"
elsif params[:name].strip.length == 0
@status = :noname
@message = "Please enter a group name."
else
@message = "???"
end
return return
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
@status = :notfound @status = :notfound
@ -57,7 +64,7 @@ class Ajax::GroupController < ApplicationController
@status = :okay @status = :okay
@success = true @success = true
@message = "Successfully created group." @message = "Successfully deleted group."
end end
def membership def membership