Created
April 5, 2011 07:45
-
-
Save kracekumar/903186 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OnlineExamController < ApplicationController | |
def index | |
@user=current_user | |
@employee=Employee.find_by_employee_number(@user.username) | |
# flash[:notice]="#{@employee.id}" | |
@subjects=EmployeesSubject.find_all_by_employee_id(@employee.id) | |
@subject_name=Array.new | |
@batch_details=Array.new | |
@display_details=Array.new | |
@count=0 | |
for @t in @subjects | |
@subject_name[@count]=Subject.find(@t.subject_id,:select=>'name,code,batch_id') | |
@batch_details[@count]=Batch.find(@subject_name[@count].batch_id,:select =>'name') | |
@display_details[@count][0]=@subject_name[@count].name+" "+@batch_details[@count].name | |
@display_details[@count][1]=@t.subject_id | |
@count+=1 | |
end | |
end | |
end | |
#view | |
</div> | |
<div id="page-yield"> | |
<% unless flash[:notice].nil? %> | |
<p class="flash-msg"> <%= flash[:notice] %> </p> | |
<% end %> | |
<div class="box"> | |
<div class="label-field-pair"> | |
<label for="student_course">Select a batch: | |
<%= image_tag("loader.gif",:align => "absmiddle",:border => 0,:id => "loader", :style =>"display: none;" ) %> | |
</label> | |
<div class="text-input-bg"> | |
<%= select :subject,:id, | |
@display_details.map {|b| [b[0],b[1]]}, | |
{:prompt => 'selecct subject'}, | |
{:onchange =>"#{remote_function( | |
:url=>{:action => 'show'}, | |
:before=> "Element.show('loader')", | |
:success => "Element.hide('loader')" )}"}%> | |
</div></div> | |
<div id="subjects"></div> | |
<div id="modal-box" style="display:none;"></div> | |
<div class="extender"></div> | |
</div></div> | |
~ | |
#error | |
You have a nil object when you didn't expect it! | |
You might have expected an instance of ActiveRecord::Base. | |
The error occurred while evaluating nil.[]= | |
/var/www/admin/app/controllers/online_exam_controller.rb:14:in `index' | |
/var/www/admin/app/controllers/online_exam_controller.rb:11:in `each' | |
/var/www/admin/app/controllers/online_exam_controller.rb:11:in `index' | |
When i comment that line it works properly and i tried in console it returns the value. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment