adds author_of? helper method

This commit is contained in:
Juanjo Bazán
2016-06-15 17:01:50 +02:00
parent fd55817832
commit 06596ac4d8
2 changed files with 32 additions and 0 deletions

View File

@@ -35,4 +35,9 @@ module ApplicationHelper
}
Redcarpet::Markdown.new(renderer, extensions).render(text).html_safe
end
def author_of?(authorable, user)
return false if authorable.blank? || user.blank?
authorable.author_id == user.id
end
end