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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:01:06+00:00 2026-06-09T13:01:06+00:00

I have both task and request controllers and models respectively. The new action of

  • 0

I have both task and request controllers and models respectively. The new action of request depends on a task :id which is included in the route. If the request cannot be save due to a validation error, I need to be able to render the new action of the request controller with the task :id. However, when the code below runs, I get a template is missing error.

How can I render the new template with the task :id as a param?

/task/1/request/new


  if !@request.save
     render :template => new_task_request_path(@blog)    # /task/1/request/new
  end

—–> Error: Template is missing –
Missing template blogs/1/requests/new

  • 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-09T13:01:07+00:00Added an answer on June 9, 2026 at 1:01 pm

    In your code, new_task_request_path(@blog) generates a relative URL.
    When rendering a template you need to give it the path to the template, not the relative URL.

    I can’t tell where your view template is going to be without more information, but try changing your code in the create action to the following:

    @task = Task.find(params[:id])
    @request = @task.requests.new(params[:request])
    
    if !@request.save
      render 'new'
    end
    

    You can then access the Task ID using @task.id in your view.

    This assumes that Task has many Requests, and that this action is in your RequestsController. If you’re using a different relationship you’ll need to update the controller action code as necessary. Similarly, if it’s a different controller you should update the template path to be something like 'requests/new'.

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

Sidebar

Related Questions

I have a task to import/transform and extract zipped binary files that contain both
I have both InDesign CS2 and CS3 installed. Both use files with .indd extension.
I have both SQL Server 2005 and Visual Studio 2008 installed and think it
I have both Rails 2.3.4 and Rails 3.0.0.beta installed on my local machine. I
I have both matrices containing only ones and each array has 500 rows and
I have both en and en-AU (Australian English) localizations for a particular file. While
I have started to learn ANTLR and have both the 2007 book The Definitive
Is it possible to have both versions of maven running on the same computer?
I would like to have both a hover and remove hover event. The nodes
I have a whole bunch of buttons that all need to have both a

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.