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

  • SEARCH
  • Home
  • 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 8942331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:29:21+00:00 2026-06-15T11:29:21+00:00

I need to create a customer model that is mostly a measure form. It

  • 0

I need to create a customer model that is mostly a measure form.

It will record some general info about the user (name, age, sex etc) and a lot of measures (height, weight, neck cisrcumference, waist etc.).

The app is targeted to international users so some will prefer to use centimeters/kilograms, other will prefer to use inches/pounds.

I think the best approach would be to store all the data in a consistent format in the database (for example metric system) and convert everything in the controller side.

Is there a canonical way (or an existing gem) to obtain this in rails? If not I would create a preferred_measure_type field in the model and then render all the views in the user preference.

Also I heard it’s wise to avoid floats and decimals and store the data in integer (in my scenario millimeters and grams) and then do all the conversion on the application side. Is that a good advice?

Thank you

  • 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-06-15T11:29:22+00:00Added an answer on June 15, 2026 at 11:29 am

    It’s always best to store data in canonical units and then convert for display purposes. Use the smallest measure that will capture the detail you require without overflowing the capacity of the column. For example, millimeters might be appropriate for shirt sizes, but might prove inadequate for measuring highways.

    As for floats, these are problematic mostly because of rounding issues. When dealing with currency, even minor discrepancies are going to cause problems. $2.00 plus $2.00 should always equal $4.00, not $3.9999917237, which might get inadvertently rounded to $3.99 leaving a penny “missing”.

    Where such precision and consistency is not required, floats are fine. The thing to remember is that a floating point number is always an approximation of any value you give it, and the accuracy diminishes as the number gets larger. That is, a float in the billions will not accurately reflect changes in the thousandths, there’s not enough precision to represent it.

    So where possible, use a fixed-place system, for instance by using a specific unit. When necessary, use a floating-point value but always be sure to round these off properly for display and remember that they are always approximations and never exact.

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

Sidebar

Related Questions

Currently i have a customer class that the user can partially create, and finish
Need to create a custom DNS name server using C which will check against
I need to create a WP site which will have multiple subjects. Each subject
I created a core data model that has three entities called Customer, Form1 and
I currently have a form where I need to remove some fields from the
I have some model classes like Customer , Product , etc. in my project
I need create custom dialog and put JPanel into it. Is it possible?
i need create an email list sending to many emails. what is best solution
I need create clone repository. but I do not know where can I get
I need create a document word with Java. And I ask, how can I

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.