开发者

How to use Disqus gem in Rails?

I'd like to use Disqus gem in a Rails app. I read through the documentation but I cannot figure out how to configure it. It appears to say we need to set a bunch of values initially. How should I configure this gem? Do I need to set up an initializer? Do I then fill it like this?

Disqus::defaults[:developer]      = false, # allows threads to开发者_如何学C work on localhost
Disqus::defaults[:container_id]   = 'disqus_thread', # desired thread container
Disqus::defaults[:avatar_size]    = 24, # squared pixel size of avatars
Disqus::defaults[:color]          = 'grey', # theme color

This didn't work when I tried. I simply don't understand what other way of doing it is there. Please help.


In the application.rb add these options:

Disqus::defaults[:account] = 'your_account_name'
Disqus::defaults[:developer] = true # if you want to test it on the localhost

and another special settings.

In the view add line:

<%= raw(disqus_thread) %> # or something different like disqus_count, etc.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜