I am building a list of user notifications. When the current user clicks an
<li>
<%= link_to activity.activable do %>
<span><%= link_to(image_tag(activity.actor.avatar.url(:thumb)), user_path(activity.actor.username)) %></span>
<span class="us-rt-sg">
<%= link_to activity.actor.name, user_path(activity.actor.username), class: "us-rt-usnm" %>
<%= activity.action %> on
<%= link_to personalize_owner(activity, recepient), user_path(activity.activable.user.username) %>
<%= link_to 'Post', activity.activable %>
<br>
<span class="us-rt-sg-date"><%= time_ago_in_words(activity.created_at) %></span>
</span>
<% end %>
<%= link_to 'Post', activity.activable %>
<li>
<li class="activity">
<%= link_to activity.activable do %>
<%= render "activities/#{activity.action}", activity: activity, recepient: recepient %>
<% end %>
</li>
The wrapping link_to
and the internal links are going to give you a headache. You have to decide what's most important in the element.
On the face of it, where you have a notification that should be clickable and link to the specified activity, you should remove the internal links and just link the whole content to the activity. Once they arrive at the activity, then you can include links to author, owner, and so on without worrying about a wrapping link.