-
-
Save eostrom/4410054 to your computer and use it in GitHub Desktop.
Another way to simplify Disqus comments (cf http://www.mwdesilva.com/posts/65-let-s-disqus).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DisqusablePresenter < Struct.new(:subject) | |
def disqus_id | |
dom_id(subject) | |
end | |
def to_s | |
# You'd probably need to include something to make the `render` helper available here. | |
render :partial => 'disqusable/disqus_thread', :locals => {:subject => self} | |
end | |
end | |
# In the view: | |
# <%= raw DisqusablePresenter.new(@post) %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since I started with the 'post-XX' format, if I switched to
dom_id
it results in a snake-cased result, i.e. 'post_XX'. Therefore, I'm going withRendering the file directly as it just cannot be located as a partial. YMMV in this regard. Thanks again :)