mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -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
|
:cooked_hidden
|
||||||
|
|
||||||
def name
|
def name
|
||||||
object.user.try(:name)
|
object.user && object.user.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def username
|
def username
|
||||||
object.user.try(:username)
|
object.user && object.user.username
|
||||||
end
|
end
|
||||||
|
|
||||||
def avatar_template
|
def avatar_template
|
||||||
object.user.try(:avatar_template)
|
object.user && object.user.avatar_template
|
||||||
end
|
end
|
||||||
|
|
||||||
def cooked_hidden
|
def cooked_hidden
|
||||||
|
|
|
@ -74,7 +74,7 @@ class PostSerializer < BasicPostSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def topic_slug
|
def topic_slug
|
||||||
object.try(:topic).try(:slug)
|
object.topic && object.topic.slug
|
||||||
end
|
end
|
||||||
|
|
||||||
def include_topic_title?
|
def include_topic_title?
|
||||||
|
|
Loading…
Reference in a new issue