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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:28:39+00:00 2026-06-17T13:28:39+00:00

I’m trying to create a review for a specific review request, but the way

  • 0

I’m trying to create a “review” for a specific “review request”, but the way I have it set up now it creates a review for a random review request when I select the “Offer a Review” button.
Here’s my reviews_controller:

class ReviewsController < ApplicationController

  def create
    @review = current_user.reviews.build(params[:review_request_id])
    if @review.save
      flash[:success] = "Review Created"
      redirect_to review_path(@review)
    else 
      flash[:error] = "Review Offer Sent"
      redirect_to root_url
    end
  end

  def show
    @review_request = ReviewRequest.find(params[:id])
  end
end

Here’s a section of the partial with the link_to the create action:

  <span class="offer_review">
    <%= link_to "Offer A Review", reviews_path(:review_request_id), :method => :post  %>
  </span>

I have

belongs_to :review_request

in the models/review.rb file and

belongs_to :user

in the review_request.rb file.

This is the index action in the review requests controller. The partial with the link is in the index view. May be part of the problem?

  def index
    @review_requests = ReviewRequest.paginate(page: params[:page])
  end
  • 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-17T13:28:40+00:00Added an answer on June 17, 2026 at 1:28 pm

    There were actually two issues here. I solved the first one (the review wasn’t being created with the review_request_id) with:

    @review_request = current_user.review_requests.build(params[:review_request])
    

    in the review_requests_controller, and:

    <%= link_to "Offer A Review", reviews_path(:review_request_id => review_request), :method => :post  %>
    

    in the view.

    I had actually solved this issue without realizing it before posting this question (and reverted back to the code above) because the redirect to the Review#show controller was wrong as well, and would show information for the wrong review_request even if the review was created correctly. (It did this because it took reviews/1 to be the review_request_id, not the review_id)

    This is the code I got that to work right:

    @review = Review.find(params[:id])
    @review_request = ReviewRequest.find(@review.review_request_id)  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I'm trying to select an H1 element which is the second-child in its group
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I have a view passing on information from a database: def serve_article(request, id): served_article
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.