From: Paul Smith Date: 2009-09-22T21:39:43+09:00 Subject: Re: Accessing an instance variable in another method On Tue, Sep 22, 2009 at 1:28 PM, Subashini Kumar wrote: > Hi, > I am new to Rails.I tried developing a basic quiz application.Please > help me out in my doubt.Thanks in advance > > <% CODE %> > > class QuizController < ApplicationController > >  def index > # i have retrieved the first five questions from the database for > displaying the #question to user >    @quiz=Quiz.find(:all,:limit=>5) > >  end > >  def report > >  end > > # this method checks the answer and gives score >  def checkanswer > # here i want to access the @quiz object which is a set of questions i > have #retreived from the database.Hot to access it? Just use @quiz. That's the point of instance variables. However, you have to make sure that checkanswer is being called at some point after index has been called, and I'm no Rails aficionado. >  end -- Paul Smith http://www.nomadicfun.co.uk paul@pollyandpaul.co.uk