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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:32:46+00:00 2026-06-11T21:32:46+00:00

Here is my Edited details: I have my controller like, class Enr::Rds::SurvRdsapXrefsController < Enr::Controller

  • 0

Here is my Edited details:

I have my controller like,

class Enr::Rds::SurvRdsapXrefsController < Enr::Controller

  def index
    @enr_rds_surv_rdsap_xrefs = Enr::Rds::SurvRdsapXref.paginate(page: params[:page])
  end

  def show
  end

  def new
     @enr_rds_surv_rdsap_xref = Enr::Rds::SurvRdsapXref.new
  end

  def edit
    @enr_rds_surv_rdsap_xref = Enr::Rds::SurvRdsapXref.find(params[:id])
  end

  def create
    @enr_rds_surv_rdsap_xref = Enr::Rds::SurvRdsapXref.new(params[:enr_rds_surv_rdsap_xref])

    respond_to do |format|
      if @enr_rds_surv_rdsap_xref.save
        format.html { redirect_to :enr_rds_surv_rdsap_xrefs, notice: "Survey link was successfully created." }
        format.js
        format.json { render json: @enr_rds_surv_rdsap_xref, status: :created, location: @enr_rds_surv_rdsap_xref }
      else
        format.html { render action: "new" }
        format.js
        format.json { render json: @enr_rds_surv_rdsap_xref.errors, status: :unprocessable_entity }
      end
    end
  end

  def update
  end

  def destroy
  end
end

Here is my view form like

<%= form_for(@enr_rds_surv_rdsap_xref, :remote => true) do |f| %>

<% if @enr_rds_surv_rdsap_xref.errors.any? %>
  <div id="error_explanation">
    <div class="validate">
      The form contains <%= pluralize@enr_rds_surv_rdsap_xref.errors.count, "error") %>.
    </div>
    <ul>
    <% @enr_rds_surv_rdsap_xref.errors.full_messages.each do |msg| %>
      <li><%= msg %></li>
    <% end %>
    </ul>
  </div>
<% end %>

<div class="control-group">
  <%= f.label :section %><br />
  <%= f.text_field :section %>
</div>

<%= f.submit %>

<% end %>

When i click the index page to create a new link, the index page showing error like

NoMethodError in Enr/rds/surv_rdsap_xrefs#index

undefined method `errors’ for nil:NilClass

Thanks for the suppport and please suggest me to rectify the error. I am new to ROR. Thanks

  • 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-11T21:32:47+00:00Added an answer on June 11, 2026 at 9:32 pm

    Your error reveals that the rendering of the index template is causing the error, which means you’re rendering the form for the new survey (the code snippet above) in the index template. This is fine, but if you’re going to do that, you’ll have to instantiate a new survey in index, as well as in new.

    At the simplest, you could just copy the code in new to index:

    def index
      @enr_rds_surv_rdsap_xrefs = Enr::Rds::SurvRdsapXref.paginate(page: params[:page])
      @enr_rds_surv_rdsap_xref = Enr::Rds::SurvRdsapXref.new
    end
    
    def new
       @enr_rds_surv_rdsap_xref = Enr::Rds::SurvRdsapXref.new
    end
    

    To keep your code a bit DRYer you might change where the new instance is created. A pattern you’ll often see is something similar to:

    before_filter :build_record, :only => [:new, :index]
    
    protected
    
    def build_record
      @survey = YourSurvey.new
    end
    

    This way you don’t even need to write the new/index methods if you don’t have any other logic.

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

Sidebar

Related Questions

/edited/ I'm new here. I have a text file that reads: 6 <cr> R
I edited some mistakes and details... Well, I have been trying to create a
EDIT: Here is the edited control file (control.ascx): <%@ Control Language=C# AutoEventWireup=true CodeFile=Sale.ascx.cs Inherits=Enmasse.Modules.Demo_Enmasse.Sale
Edit my code to make it work please. Edited for latest version. Here is
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }
Here is the Javascript I currently have <script type=text/javascript> $(function() { $('.slideshow').hover( function() {
(Edited to avoid leading down the wrong road) Before giving details, very short version:
Details: I'm basically trying to implement the functionality of the example here ( http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editondblclick/defaultvb.aspx
I'm not sure I'm phrasing my question correctly, so here's the details. I'm using
I have a script here, and it works amazing, except for one small detail.

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.