mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
PERF: avoid needless :try invokes respond_to? etc
This commit is contained in:
parent
6246dd0aa2
commit
43345063b9
2 changed files with 4 additions and 4 deletions
|
@ -9,15 +9,15 @@ class BasicPostSerializer < ApplicationSerializer
|
|||
:cooked_hidden
|
||||
|
||||
def name
|
||||
object.user.try(:name)
|
||||
object.user && object.user.name
|
||||
end
|
||||
|
||||
def username
|
||||
object.user.try(:username)
|
||||
object.user && object.user.username
|
||||
end
|
||||
|
||||
def avatar_template
|
||||
object.user.try(:avatar_template)
|
||||
object.user && object.user.avatar_template
|
||||
end
|
||||
|
||||
def cooked_hidden
|
||||
|
|
|
@ -74,7 +74,7 @@ class PostSerializer < BasicPostSerializer
|
|||
end
|
||||
|
||||
def topic_slug
|
||||
object.try(:topic).try(:slug)
|
||||
object.topic && object.topic.slug
|
||||
end
|
||||
|
||||
def include_topic_title?
|
||||
|
|
Loading…
Reference in a new issue