alright
This commit is contained in:
parent
4a8005b195
commit
44b4e8721a
|
@ -9,22 +9,21 @@ class Ajax::GroupController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
params.require :name
|
params.require :name
|
||||||
|
rescue ActionController::ParameterMissing
|
||||||
|
@status = :toolong
|
||||||
|
@message = "Please give that group a name."
|
||||||
|
return
|
||||||
|
end
|
||||||
params.require :user
|
params.require :user
|
||||||
|
|
||||||
begin
|
begin
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue