handle invalid param gracefully
This commit is contained in:
parent
8277a586bb
commit
d676bbc349
|
@ -14,7 +14,9 @@ class IncomingLink < ActiveRecord::Base
|
||||||
user_id, host, referer = nil
|
user_id, host, referer = nil
|
||||||
current_user = opts[:current_user]
|
current_user = opts[:current_user]
|
||||||
|
|
||||||
if username = opts[:username]
|
username = opts[:username]
|
||||||
|
username = nil unless String === username
|
||||||
|
if username
|
||||||
u = User.select(:id).find_by(username_lower: username.downcase)
|
u = User.select(:id).find_by(username_lower: username.downcase)
|
||||||
user_id = u.id if u
|
user_id = u.id if u
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue