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

The Archive Base Latest Questions

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

I have recently created a Rails application to handle parent comments for a company

  • 0

I have recently created a Rails application to handle parent comments for a company I work for. Each comment is given a score (1-10) by a moderator, I am trying to create a window on an html page that will randomly display a comment in the database as long as it has a score of at least 7. The rails app also has User authorization requirements to be able to view the database of comments.

I know this is possible but I only recently learned Ruby on Rails and am rather new to the html world as well. I am extremely willing to learn something like jquery or ajax if that is what is needed to make this work. I just need some direction so I can get started displaying the comments. Thank you for any help!

  • 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:51:59+00:00Added an answer on June 15, 2026 at 11:51 am

    Perhaps you could have an action in your CommentsController like this:

    def random_high_rated
      @comment = Comment.where(score: 7..10).sample
    end
    

    Your route in config/routes would look something like this:

    resources :comments do
      collection do
        get '/random_high_rated'
      end
    end
    

    And you would access it at:

    yoursite.com/comments/random_high_rated
    

    Make a view at app/views/comments/random_high_rated.html.erb

    And in it:

    <%= @comment %>
    

    EDIT:

    Read through this tutorial and you’ll be able to write your own code in no time!

    http://ruby.railstutorial.org/ruby-on-rails-tutorial-book

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

Sidebar

Related Questions

I have recently created a new rails 3 application, using the code that I
I have recently upgraded to Rails 3 and created a new application with Rails
I have recently created an application for wp7. Now i am ready submit an
I have recently implemented something in a rails application that allows me to read
Hello, we have recently updated an application to Rails 3.0.4 (3.0.5 on online devel
I have recently started building an application in rails (3.0.5). Just to get things
I have recently created a new application that is using MVC4 and EF5. The
I have recently created a small VB application for a friend of mine, I
I have recently created a directory for a customer of mine. The website is
I have recently created a HTML5 canvas animation (also using Processing.js). The problem is

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.