Module: VotesHelper

Defined in:
app/helpers/votes_helper.rb

Instance Method Summary collapse

Instance Method Details

Parameters:



3
4
5
6
7
8
9
10
11
12
# File 'app/helpers/votes_helper.rb', line 3

def admin_votable_link(entity)
  text = entity.model_name.human
  path = '#'
  if entity.is_a?(Comment)
    text << ": #{entity.commentable.model_name.human}"
    text << " <cite>#{entity.commentable.title}</cite>"
    path = admin_comment_path(id: entity.id)
  end
  link_to(text.html_safe, path)
end

Parameters:



15
16
17
18
19
20
21
22
23
# File 'app/helpers/votes_helper.rb', line 15

def votable_link(entity)
  text = entity.model_name.human
  path = '#'
  if entity.is_a?(Comment)
    text += " #{entity.commentable.title}"
    path = entity.commentable
  end
  link_to(text, path)
end