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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:41:05+00:00 2026-06-01T15:41:05+00:00

I have a fairly complex view that has multiple forms, lots of validations on

  • 0

I have a fairly complex view that has multiple forms, lots of validations on those forms, paginations, and other features. When validations fail, I like to use render because then you can be more specific about what errors occurred in the forms. However, when I use render different compiler errors crop up such as “undefined method `total_pages’ for []:Array” and “undefined model_name”. Is this a situation when I have to use redirect_to or is it feasible to somehow work around the errors that are coming up when the view is being rendered. Thanks a bunch!

  • 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-01T15:41:06+00:00Added an answer on June 1, 2026 at 3:41 pm

    You should grasp things in their perspective.

    Why is render used instead of redirect:

    • when you use render, you pass the instantiated object

    • this object, newly created or updated, received some params

    • when attempting to save the object, validation was triggered and, if unsuccessful, added errors to the current instance

    • so your object in memory contains validation errors.

    But when you use redirect, you restart with a fresh stack which doesn’t know anything about the former object in memory, there could not be any magic:

    • either the object is saved and you can get the persisted data from database

    • or if it’s not saved, you can have some information you previously stored in session


    To answer your question a bit closer: before you use render, you have to instantiate all objects needed by the page.

    It’s just logic the view fails if the expected instance variables are missing.

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

Sidebar

Related Questions

I have a fairly complex view that points back to other pages within my
I have a fairly complex html form enhanced via jquery. It has multiple tabs,
I have some fairly complex libraries that interconnect with each other to do some
I have a fairly complex application which has been broken up into multiple components.
I have a fat GUI that it getting fairly complex, and I would like
I have a fairly complex object which has some C# code written to render
I have a fairly complex ASP MVC set of controls that set a data
I have an ant build script with a fairly complex <exec> command with lots
For my app, I have a fairly complex set of configuration options that user
I have a stored proc that performs a fairly complex SELECT statement. The stored

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.