Method: BaseHelper#commentable_url

Defined in:
app/helpers/base_helper.rb

#commentable_url(comment) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/base_helper.rb', line 8

def commentable_url(comment)
  if comment.recipient && comment.commentable
    if comment.commentable_type != "User"
      polymorphic_url([comment.recipient, comment.commentable])+"#comment-#{comment.id}"
    elsif comment
      user_url(comment.recipient)+"#comment-#{comment.id}"
    end
  elsif comment.commentable
    polymorphic_url(comment.commentable)+"#comment-#{comment.id}"
  end
end