> > Colin I get the following error when I goto the privilege page.
NoMethodError in Employee#edit_privilege Showing app/views/employee/edit_privilege.html.erb where line #82 raised: 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.[] Extracted source (around line #82): 79: <table width="100%" align="center" cellspacing="1" cellpadding="1" class="table_design"> 80: <tr> 81: <% @privilege_tags.each_with_index do |privilege_tag,ind| %> 82: <% all_privileges = privilege_tag.privileges.all(:conditions=>"name<>'FinanceControl'",:order=>"priority ASC").select{|p| p.applicable?} %> 83: <% if all_privileges.count > 0 %> 84: <% if ind==0 or ind==1 or ind==4 %> 85: <td> The development log is below: Processing EmployeeController#edit_privilege (for 127.0.0.1 at 2016-03-26 13:49:00) [GET] Parameters: {"action"=>"edit_privilege", "controller"=>"employee", "id"=>"emp-0002"} [4;35;1mUser Load (1.0ms)[0m [0mSELECT * FROM `users` WHERE (`users`.`id` = 1) AND (`users`.`is_deleted` = 0) [0m [4;36;1mConfiguration Load (1.0ms)[0m [0;1mSELECT * FROM `configurations` WHERE (`configurations`.`config_key` = 'Locale') LIMIT 1[0m edit_privilge method in controller is below def edit_privilege @user = User.active.first(:conditions => ["username LIKE BINARY(?)",params[:id]]) @employee = @user.employee_record @privilege_tags=PrivilegeTag.find(:all,:order=>"priority ASC") @user_privileges=@user.privileges if request.post? new_privileges = params[:user][:privilege_ids] if params[:user] new_privileges ||= [] @user.privileges = Privilege.find_all_by_id(new_privileges) redirect_to :action => 'admission4',:id => @employee.id end end -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/926003e903b01ebb2f201a77d2ac328d%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.