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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:11:48+00:00 2026-05-21T20:11:48+00:00

I have a Review model which allows for a ‘1-10’ rating system on products.

  • 0

I have a Review model which allows for a ‘1-10’ rating system on products. In my form view, here is how I did the field to spit out a dropdown of 1-10…

<%= f.select :rating, options_for_select((0..10).to_a, @review.rating) %>

Works great, but the team is now wanting to have .5 decimal numbers for the rating system, so something can be rated 7.5, 8.0, 8.5, etc.

However, that has me stumped…how can I alter the above code and iterate through a set of numbers and increment it by .5 each time in Ruby? (Note: Yes, I have already converted my rating column from an integer to a float.)

  • 1 1 Answer
  • 3 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-21T20:11:49+00:00Added an answer on May 21, 2026 at 8:11 pm

    You can define the increment as so

    (0..10).step(0.5)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view which accepts the following model: Inherits=System.Web.Mvc.ViewPage<MVC_WordsByME.Models.JobCreationModel> This posts back to
I have the following view that allows a user to add a review for
Well i have a complex form view model like this : public class TransactionFormViewModel
I have a model: review.rb class Review < ActiveRecord::Base validates :title, :presence => true
I have Comment as a polymorphic model. It is attached to Post, Review, etc.
I have a little piece of rails code which lets users enter a review.
I have an Index.cshtml view: @model AttendenceModel @{ Layout = ~/Views/Shared/_Layout.cshtml; } @using (Html.BeginForm(VisOppsummering,
I have an ActiveRecord model Media which is supposed to be able to store
i'm looking for solution how to have a landing page with products which are
My scenario: Movies have reviews, reviews have comments. Movie model: has_many :reviews Review model:

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.