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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:11:24+00:00 2026-05-20T23:11:24+00:00

Please pardon the newbie question, but I’m stumped. I’m a teacher converting a Rails

  • 0

Please pardon the newbie question, but I’m stumped. I’m a teacher converting a Rails
1 app to Rails 3. My “verify” controller is getting correct values from my database,
but when the view attempts to access the variables I’m told they are in “nilClass”.
Here’s my controller:

file ROOT/app/controllers/verify_controller.rb:

class VerifyController < ApplicationController
    @student = Assignment.get_student
    @assignments = Assignment.get_assignments
    logger.info("VERIFY: @student is #{@student}")
    logger.info("VERIFY: @assignments is #{@assignments}")
end

Here is my view:

file ROOT/app/views/verify/list.html.erb:

<?xml version="1.0" encoding="UTF-8" ?>
<!--
    This is our listing view.
-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Student assignments</title>
</head>
<body>

<div id="assignment-list">

  <!-- @student is a Ruby variable.  The @ means it is a "member"
       which is accessible beyond the code that calculates it.  (The
       class is the VerifyController class, which we will be seeing
       shortly.)  See below for the angle brackets!
  -->

  <h2>Assignments for <%= @student %></h2>
  <table cellspacing="5" cellpadding="5" border="2">
    <tr>
      <th>Student</th>
      <th>Description</th>
      <th>Date received</th>
    </tr>

  <!-- HTML alone doesn't know how many rows are in the table, so
       Ruby has to look at the variables and provide a loop to do
       the rows .
  -->

  <!--  < % and % > delimit Ruby code in HTML so long as the Ruby
        doesn't produce a value (there is no blank space between
        the angle brackets and the % signs; I had to put one in
        to prevent Ruby from trying to interpret this comment!)
        If the expression does produce a value, < % = and % > are the
        delimiters.
  -->
  <% logger.info("LIST: The class of @student is #{@student.class}") %>
  <% logger.info("LIST: The class of @assignments is #{@assignments.class}") %>
  <% logger.info("LIST: @student is #{@assignments}") %>
  <% logger.info("LIST: @assignments is #{@assignments}") %>
  <% for assign in @assignments %>
     <tr>
       <td><%= assign.student %></td>
       <td><%= assign.description %></td>
       <td><%= assign.whendone %></td>
     </tr>
  <% end  # end the "for" %>
  </table>
</body>
</html>

Any suggestions?
  • 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-05-20T23:11:25+00:00Added an answer on May 20, 2026 at 11:11 pm

    You are using the variables correctly, but the error would suggest that Assignment.get_student is returning nil instead of a student. Check this method in the Assigment model.

    Also, not sure if it was a paster error, but your controller should look like this:

    class VerifyController < ApplicationController
    
      def list
        @student = Assignment.get_student
        @assignments = Assignment.get_assignments
        logger.info("VERIFY: @student is #{@student}")
        logger.info("VERIFY: @assignments is #{@assignments}")
      end
    
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

please pardon the absolutely newbie question but i'm very new to tableau. what I'd
Please pardon me asking this rudimentary question, but let me know if anyone knows
Please pardon me if I am asking an obvious question, but after going through
Please Pardon if the question sounds silly, but nevertheless its a question which I
Please pardon me for being a complete newbie, but I'm following a tutorial (
Perhaps this is a very basic question, please pardon me if it is ---
I am an iOS newbie, so please pardon me if this is a beginner
Please pardon me if this has been asked before, but I'm wondering if there
Working on my first rails project so please pardon any incorrect terminology. I created
I am really new to C++ programming so please pardon my silly question. I

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.