Skip to content

Instantly share code, notes, and snippets.

@jsuchal
Last active August 29, 2015 13:57
Show Gist options
  • Save jsuchal/9628024 to your computer and use it in GitHub Desktop.
Save jsuchal/9628024 to your computer and use it in GitHub Desktop.
def link_to_notifiable(notifiable)
notifiable.link_to_notifiable(self)
end
# concerns/notifiable_presenters.rb
class Answer
def link_to_notifiable(helper)
helper.link_to_answer, question
end
end
class Comment
def link_to_notifiable(helper)
helper.link_to_comment, to_question
end
end
class Favorite
def link_to_notifiable(helper)
helper.link_to_question, question
end
end
class Question
def link_to_notifiable(helper)
helper.link_to_question, self
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment