Topic: Akismet Plugin for Rails

I'm having a hard time just including this into my comments controller.

I've installed it per the directions on the site:

script/plugin install svn://rubyforge.org/var/svn/ror-akismet

The plugin appears to be in the right place; under vendors/plugins/ror-akismet

I have modified the akismet.yml with my specific Akismet API key and blog url.

I add "include Akismet" (without quotes) to my comments controller.

When I try to call the Create action, I get a NoMethodError:

NoMethodError in CommentsController#create

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.empty?

/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2.6747/lib/active_support/dependencies.rb:376:in `new_constants_in'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2.6747/lib/active_support/dependencies.rb:202:in `load_file'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2.6747/lib/active_support/dependencies.rb:94:in `require_or_load'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2.6747/lib/active_support/dependencies.rb:248:in `load_missing_constant'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2.6747/lib/active_support/dependencies.rb:452:in `const_missing'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2.6747/lib/active_support/dependencies.rb:464:in `const_missing'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2.6747/lib/active_support/dependencies.rb:470:in `send'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2.6747/lib/active_support/dependencies.rb:470:in `const_missing'
#{RAILS_ROOT}/app/controllers/comments_controller.rb:3

Just in case it was something inside my code for the Create action, I removed all the code from the Create action (aka having an empty action) and it still raises the same error.

Simply removing the incude Akismet line puts everything back to normal. Of course, then I can't use Akismet.

I'm confused as to why this is happening.

Any help would be greatly appreciated.

Carlos

Re: Akismet Plugin for Rails

I found out why this was happening.

After much troubleshooting, it turns out that Rails didn't like the "-" character in the plugin directory name.

When you download the plugin, it creates a directory called ror-akismet. This seemed to cause troubles for me. Renaming it to ror_akismet solved the issue.

Is this a bug or a known issue?

Re: Akismet Plugin for Rails

Just wanted to contribute to the google gods -- I had the same problem with acts_as_paranoid with Rails 1.2.3

I had to rename the plugin from acts_as_paranoid-1.1.4 to acts_as_paranoid.  Works fine now.

Last edited by benmoore (2007-07-17 15:29:12)

Re: Akismet Plugin for Rails

Ben,

Thanks for adding your input. I'm sure it'll help some people out there. It must be a bug in Rails 1.2.3. Anyone running Edge Rails have this issue?