开发者

How do I add the Disqus comment system to a Rails application in a similar fashion to Wordpress?

开发者 https://www.devze.com 2022-12-22 18:19 出处:网络
In Wordpress, the Disqus plugin allows you to choose to subscribe to a post via RSS or via email.Is there a pluign similar to the Wordpress plugin for Rails.Norman\'s Disqus plugin just uses the Disqu

In Wordpress, the Disqus plugin allows you to choose to subscribe to a post via RSS or via email. Is there a pluign similar to the Wordpress plugin for Rails. Norman's Disqus plugin just uses the Disqus site to make it work. I was hoping to have things more stored locally. For an example of what I mean, take a look at this blog entry.

I already know that since Rails (this application in particular) is using Authl开发者_如何学编程ogic (plus Facebook Connect), that Disqus cannot be too tightly coupled with the Authentication system. Has anyone ever done this or figured out a way to do this?


Pardon me, but I'm slightly confused by your question...

You state that the disqus plugin used by Wordpress allows you to subscribe via RSS and email.... Well so does Norman's Disqus plugin. I am using it and can assure you that it offers the same functionality of the version Wordpress uses.

Secondly, you say that "Norman's Disqus plugin just uses the Disqus site to make it work"... I'm not being funny here, but what do you mean by that? I'd expect Norman's Disqus plugin to use the Disqus site, as opposed to say, BurgerKing's site.... :)

It seems that you are under the impression that Norman's Disqus plugin doesn't work? It works fine, just like the wordress one...

You also say that "I was hoping to have things more stored locally." Are you implying that you want to store your comments in your own Database? Surely not? There would be no point in using disqus if that were the case.....

Here are some tips on getting normans disqus plugin working....

1) gem install disqus 

If you want the comments to appear when a user hits http://mysite.com/blog/1-test-post then just open up show.html.haml (or erb if you are not using haml) and add the following wherever you want the comments to appear:\

#disqus_thread
  = disqus_thread

If you are using erb then do this instead:

<div id ="disqus_thread">
  <%= disqus_thread %>
</div>

Done.

I can assure you that Norman's plugin (or gem) works just the same as it does in Rails as it does on Wordpress....

Good luck - let me know if you have any trouble, I'll be happy to help..

EDIT:

forgot to mention that you need to stick some things in your config/environment.rb file inside the "Rails::Initializer.run do |config|" block:

  config.after_initialize do
    Disqus::defaults[:account] = "your account name"
    # so that the comments will load up in development environment
    Disqus::defaults[:developer] = true 
    Disqus::defaults[:container_id] = "disqus_thread"
    Disqus::defaults[:show_powered_by] = false
  end


http://praaveenvr.blogspot.in/2014/05/adding-disqus-comment-system-to-rails-3.html?view=sidebar

step 1

gem install disqus

step2

add in application.rb(user should registered to consume service)

config.after_initialize do  
   Disqus::defaults[:account] = "youraccountname"  
   Disqus::defaults[:developer] = true  
   Disqus::defaults[:container_id] = "disqus_thread"  
   Disqus::defaults[:show_powered_by] = false  
   end  

step3

add this to view file(example: show.html.erb)

<div id ="disqus_thread">  
 <% = raw disqus_thread %>  
</div>  

start the server and check.....

0

精彩评论

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