<% if content.favorite? icon = 'star' action = 'Unfavorite' else icon = 'star_border' action = 'Favorite' end %> <% if content.persisted? && user_signed_in? && content.user_id == current_user.try(:id) %> <%= icon %> <% end %>