PERF: avoid needless :try invokes respond_to? etc
This commit is contained in:
parent
6246dd0aa2
commit
43345063b9
|
@ -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 New Issue