Method: ApplicationHelper#generic_share_link

Defined in:
app/helpers/application_helper.rb

Gets a shareable URL to the specified post, taking into account post type.

Parameters:

  • post (Post)

    The post in question.

Returns:

  • (String)


150
151
152
153
154
155
156
# File 'app/helpers/application_helper.rb', line 150

def generic_share_link(post)
  if second_level_post_types.include?(post.post_type_id)
    answer_post_url(id: post.parent_id, answer: post.id, anchor: "answer-#{post.id}")
  else
    post_url(post)
  end
end