Mollom in Rails 3
How can I use Mollom Gem with a Rails 3 application?
I have installed the gem via: sudo gem install 'mollom' I have the following entry in the Gemfile: gem 'mollom' In the controller I have wrote: require 'mollom' But this line in the controller is giving the following error: "no such file to load -- mollom"If I delete that line from the controller, then I have this error: uninitialized constant PostController::Mollom when trying to use Mollom.new...
Any ideas how to fix it would be 开发者_JAVA技巧great. I already have the keys from Mollom and everything works well on irb.
Thank you.
Best regards,
Tony.Ok, found the solution. I was too stupid to add the require '...' in the controller.
Instead, add:
require 'rubygems' and
require 'mollom'
in the application.rb file.
In the documentation here: http://mollom.rubyforge.org/ there is a mistake, at least when I used it with Rails 3. You need to replace: m.check_captcha with m.valid_captcha?
精彩评论