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 6321205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:06:38+00:00 2026-05-24T16:06:38+00:00

In my discussion board I have a Post class. There are two special functions,

  • 0

In my discussion board I have a Post class. There are two special functions, which I want to know where is the best place to put them.

First, I have an author field, and the user input will be tripcoded. For example name#tripcode becomes name◆3GqYIJ3Obs (Wikipedia). I currently does it in before_save in the model, but I am wondering if this should go to the controller.

Second, I have a hashed_ip field, which basically pass the user ip with md5 and encryption. I am still working on it, but the act of setting params[:hashed_ip] with a plain ip for the model to process seems semantically wrong, but at the same time it makes the code cleaner.
If I am using other languages, I’d simply have a constructor which will do the handle this conversion, which will be semantically better and cleaner at the same time.
I am not sure if I can obtain the IP within the model directly.

Thanks

  • 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-24T16:06:38+00:00Added an answer on May 24, 2026 at 4:06 pm

    Generally your controller should be as lean as possible and the logic for preparing the data, specially in this case, does belong in the model.

    Regarding your second question, you cannot directly access the IP address from the model, that data is accesible only through the controller. Of course you could create a module/class that extended from Rack/ActionController to get that data but it’s just not worth it in your case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Discussion Board in a SharePoint site which has an additional column
I am writing a discussion board software that will have avatar images for the
How we can implement reply to reply features in Sharepoint discussion Board. I have
I have FBA sharepoint site. I am trying to use discussion board RSS feed
This discussion started over here but I thought it would be nice to have
A discussion happened today where a grid containing data, which ultimately had data attached
I had a discussion with some colleagues mentioning that there are not too many
During a discussion about security, a developer on my team asked if there was
I liked the discussion at Differences in Generics , and was wondering whether there
I have a web app that create groups. Each group gets their own discussion

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.