I will show you how to use Juvia as the commenting system for your Rails application.
What is Juvia?
Head over to github.com/phusion/juvia and follow the steps in "Installation" section. However I found my self doing these stuff in order to finish the installation steps provided.
On step #3, use
mysql2 instead of
mysql as adapter
production: adapter: mysql2 database: juvia host: localhost username:
Before step #4, add
gem 'therubyracer' into
group :assets do gem 'sass-rails', '~> 3.1.5' gem 'coffee-rails', '~> 3.1.1' gem 'therubyracer' gem 'uglifier', '>= 1.0.3' end
Before step #5,
$ cp config/application.yml.example config/application.yml
and change the configuration as you need.
Throw Juvia to Passenger or whatever application server you prefer. When you access Juvia for the first time, it will ask you to create an initial administrator account to register a site.
After your site has been registered, Juvia will show a snippet of code for you to embed into your web pages.
For the purpose of this post, I created a simple blog application. Nothing special from the application, just a scaffold for Post.
app/views/posts/show.html.erb and add this code on the last line
Then paste previously copied code snippet from Juvia on the bottom of the file
container : '(a CSS path)', to
container : '#comments',
The container is a CSS path referring to the DOM element in which you want to embed the Juvia comments page, in our case #comments.
Other Juvia options you need to change are
topic_key- Unique identifier withing the context of a site. If you are running a blog site, you may want to set this to current category of your post.
topic_title- Specifies a title for topic_url. It is a good practice to set this with document_title value, that is why you need to make sure your document
<title>is informative. My suggestion is using blog name and post title together, i.e "My Blog - Rails 3.2.1 up and running in 1 minute".
Juvia already provide you options on how to moderate comments, Akismet integration and email notification of new comments features that will save you hours of your development time.
While Juvia is a good (if not the best) alternative when you need to build a simple and complete commenting system for multiple web apps. Nevertheless, I don't think Juvia will handy when you need a commenting system for a single web app.