Permalink
Browse files

PERF: avoid needless :try invokes respond_to? etc

  • Loading branch information...
SamSaffron committed Oct 2, 2015
1 parent 6246dd0 commit 43345063b949bb349f4eb9ad131ac7a1d5ea6707
Showing with 4 additions and 4 deletions.
  1. +3 −3 app/serializers/basic_post_serializer.rb
  2. +1 −1 app/serializers/post_serializer.rb
@@ -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 @@ def initialize(object, opts)
end

def topic_slug
object.try(:topic).try(:slug)
object.topic && object.topic.slug
end

def include_topic_title?

0 comments on commit 4334506

Please sign in to comment.