Update comment.rb
allow Comment#for_creator to handle null user id case
This commit is contained in:
@@ -54,11 +54,11 @@ class Comment < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def for_creator(user_id)
|
def for_creator(user_id)
|
||||||
where("creator_id = ?", user_id)
|
user_id.present? ? where("creator_id = ?", user_id) : where("false")
|
||||||
end
|
end
|
||||||
|
|
||||||
def for_creator_name(user_name)
|
def for_creator_name(user_name)
|
||||||
for_creator(User.name_to_id(user_name).id)
|
for_creator(User.name_to_id(user_name))
|
||||||
end
|
end
|
||||||
|
|
||||||
def search(params)
|
def search(params)
|
||||||
|
|||||||
Reference in New Issue
Block a user