the-trash/the_comments

Server Error: 500

Closed this issue · 6 comments

When I try to add a comment I get this error:

NameError (uninitialized constant TheCommentsController::Base::IpBlackList):
app/controllers/concerns/the_comments_controller.rb:207:in `stop_black_ip'

This same with 'top_black_user_agent' and class UserAgentBlackList.

I think we need models?

Thank you for your issues! It's great!

It's was one of last changes before release - that's why it's has problems.

Yes, we need 2 additions models:

There is my code of models of my blog (under development) - https://github.com/open-cook/open-cook/tree/master/app/models

class IpBlackList < ActiveRecord::Base
  include TheCommentsBlackIp
end
class UserAgentBlackList < ActiveRecord::Base
  include TheCommentsBlackUserAgent
end

I'll copy this files via generator in next relese. I'll try to do it tomorrow.

I am glad that I can help to make this project even better. One small thing - gem requires kaminari I think.

https://github.com/the-teacher/the_comments/blob/master/app/views/the_comments/manage.html.haml#L1

Yes! your right - I use kaminary, but, in fact, I should close this code with comments - gem should not be dependent of kaminary

You are right. I use a lot will_paginate (Kaminari stuff you have also in comments controller).

oh! Now I remember!

I think users of gem should use following generator

bundle exec rails g the_comments:views views

after that you can replace kaminary with will_paginate

That's why views haven't comments for kaminary method

  1. I remove attr_accessible declarations
    https://github.com/the-teacher/the_comments/blob/master/app/models/concerns/the_comments_base.rb#L5
  2. I fix generator

https://github.com/the-teacher/the_comments/blob/master/lib/generators/the_comments/the_comments_generator.rb#L11

You can copy models with

bundle exec rails g the_comments install models
  1. I update gem

but it's not tested - I have no time to do it. sorry