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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:31:51+00:00 2026-06-11T01:31:51+00:00

In my app, users can write reviews for products. But before publishing the review,

  • 0

In my app, users can write reviews for products. But before publishing the review, the admin needs to accept the review or reject it (allowing the user to change its review).

To manage the validation part, I created the validate method inside the Reviews controller. The admin has two buttons (links) near the new review: Accep, Reject. That buttons redirect to the validate#reviews and send the appropriate parameters: review_id and admin_action (accept or reject).

How do I create the path of the buttons (links)?

I tried many combinations like link_to "accept", polymorphic_path([review, :validate => 'accep']) but without success. I have trouble to figure out how the URL should look like! Of course, I added get 'reviews/validate' to routes.rb before.

If you had in a similar situation, how did you do? Is there best practices?

Update

I also tried link_to "Accept", polymorphic_path(:reviews => review, :validate => 'accept'), but get a Nil location provided. Can’t build URI.

Update 2

I would like to use the validate method (instead of creating two methods accept and reject) because there are common data processing, like getting the review, checking admin auth,…

So, in my controller, I’m looking for something like:

def activate
    # Get review, using review_id

    # Check in the admin has the right to validate the review

    # Execute the correct action: accept or reject.
end

private
def accept
    ...
end

def reject
    ...
end

Thanks in advance.

  • 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-11T01:31:53+00:00Added an answer on June 11, 2026 at 1:31 am

    In your routes.rb:

    resources :reviews do
      member do
        put :accept
        put :reject
      end
    end
    

    This will make the urls reviews/:id/accept and reviews/:id reject available through the helpers accept_review_path(@review) and reject_review_path(@review).

    Last thing, in your ReviewsController add

    def accept
      @review = Review.find(params[:id])
      # Your accept logic here
    end
    
    def reject
      @review = Review.find(params[:id])
      # Your reject logic here
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making an app where users can write reviews on venues and currently have
Just as on StackOverflow, in my app a User can write Questions and can
I have an app where users can change a toggle value between true and
I have an app where users can sign up with Facebook, in which case
I'm developing a web app where users can get coupons and similar things. I
I'm writing an Android app where users can upload video to Youtube. I'd like
I have a wizard in my app where users can go back and forward
I have a vector drawing app where users can draw lines using multiple quadratic
We have an HTML5 drawing app where users can draw lines using a pencil
I have a form in my django app where users can upload files. How

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.