Ask A Question

Notifications

You’re not receiving notifications from this thread.

Best way to create a report/spam button?

Ryan Carter asked in Rails

Just looking for ideas on the best way to create a report or spam button/link on posts and comments. And do you typically have that notification sent to an in program inbox to an admin email, etc.

Thanks,
Ryan

Reply

@ryan it is pretty straight-forward. Typically you count how many times that button is pushed (if it is user facing) and then start applying rules based on that count to auto-remove and what not. You could do that with a simple counter on the model in question. Just have it do it via AJAX and it will be a smooth and nice interaction.

On the other hand if this is admin facing and just flags the comment/post then I would create a table called flags or something like that and it could store the type as a string ("spam" or "reported") and then contain the model name and id (polymorphic). This would give you a list of all the comments/posts that had been flagged or reported and allow you to do whatever you wanted with them.

In actuality the second approach is probably the most flexible since it allows any model to be reported or be considered a spam entry. The only difference is you would be the counter on that model if the UX was user facing.

Anyway, that is a couple of ways to do it. Hope it helps!

Reply

Casey, thanks for the suggestions. I appreciate the time taken to help.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 85,376+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.