Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5990129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:11:58+00:00 2026-05-22T23:11:58+00:00

I am attempting to create something along the lines of How to Implement Basic

  • 0

I am attempting to create something along the lines of How to Implement Basic Defensio Spam Protection in Rails but I’m running into a problem. In the article they have something like:

def self.init(attributes)
    self.new(clean!(attributes))
end

private

def self.clean!(attrs)
    returning({}) do |cleansed_attributes|
        attrs.each do |key, value|
            cleansed_attributes.merge!(key.to_s.underscore => value)
        end
    end
end

They are then calling DefensioResponse.init. In my case however I had it setup a a little bit differently. I’m calling comment.build_defensio() (my model is called Defensio instead of DefensioResponse) and it appears that self.init is never being called. How should I change the above code block in order to have it work w/ comment.build_defensio()?

For More Information

If you need to look at any of the source code I have it hosted over on Github.

Basically what I’m doing is submitting a comment (Skatepark::Comment), after it successfully saves DefensioJob gets enqueued w/ Delayed::Job.enqueue(DefensioJob.new(self.id)). Inside of the defensio job is where I’m attempting to create and save a new Skatepark::Comment::Defensio record.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:11:59+00:00Added an answer on May 22, 2026 at 11:11 pm

    You could override initializer of model, like this

    def initialize(attributes = {})
      super(clean!(attributes))
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to create a custom messaging app. Just something basic but I
I'm attempting to load a dll into MSSQL with: USE dbname GO CREATE ASSEMBLY
I am attempting to create a fixed step loop in my program, but for
I am attempting to create two identical objects in VB6 by assignment statements; something
I'm attempting to create an xquery expression that will return selected nodes but will
When attempting to create a new Ruby on Rails app in Windows the command
I'm attempting to create a custom calendar control that inherits from ASP.Net's built in
I'm currently attempting to create a tabbed interface in a web application, and based
I am attempting to create a small application to collect data received from an
I am attempting to create new membership users in an Ektron CMS400.NET-based website by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.