[rspec-users] <help> renders new/edit user_mst form

oliver oliverjesus2008 at yahoo.com
Mon Jun 10 09:47:45 UTC 2013



--- On Mon, 6/10/13, David Chelimsky-2 [via Ruby] <ml-node+s11n4991631h25 at n6.nabble.com> wrote:

From: David Chelimsky-2 [via Ruby] <ml-node+s11n4991631h25 at n6.nabble.com>
Subject: Re: <help> renders new/edit user_mst form
To: "oliver" <oliverjesus2008 at yahoo.com>
Date: Monday, June 10, 2013, 9:36 AM



	On Mon, Jun 10, 2013 at 4:25 AM, oliver <[hidden email]> wrote:

<%= f.select :group_name, options_for_select(@group_mst.collect{|x| [x.group_name]}), {:multiple => :multiple} %>




that is on the line 44.

And the error raised on that line says "The error occurred while evaluating nil.collect". The only thing receiving "collect" on that line is @group_mst, so the spec has to do something to assign an Enumerable to @group_mst before calling render in the spec. Is there a line in the controller that assigns something to @group_mst? If so, what's on that line?




_______________________________________________

rspec-users mailing list

[hidden email]

http://rubyforge.org/mailman/listinfo/rspec-users

	
	
	
	

	

	
	
		If you reply to this email, your message will be added to the discussion below:
		http://ruby.11.x6.nabble.com/help-renders-new-edit-user-mst-form-tp4991623p4991631.html
	
	
		
		To unsubscribe from <help> renders new/edit user_mst form, click here.

		NAML
	


 def new 
    @user_mst = UserMst.new 
    @group_mst = GroupMst.all 

    respond_to do |format| 
      format.html # new.html.erb 
      format.xml  { render :xml => @user_mst } 
    end 
  end 

  def edit 
    @user_mst = UserMst.find(params[:id]) 
        @group_mst = GroupMst.all 
  end 

 def create 
    @user_mst = UserMst.new(params[:user_mst]) 
        @group_mst = GroupMst.all 

    respond_to do |format| 
      if @user_mst.save 
        format.html { redirect_to(@user_mst, :notice => 'User mst was successfully created.') } 
        format.xml  { render :xml => @user_mst, :status => :created, :location => @user_mst } 
      else 
        format.html { render :action => "new" } 
        format.xml  { render :xml => @user_mst.errors, :status => :unprocessable_entity } 
      end 
    end 
  end 

Those are the lines I include @group_mst. 



--
View this message in context: http://ruby.11.x6.nabble.com/help-renders-new-edit-user-mst-form-tp4991623p4991633.html
Sent from the rspec-users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20130610/ea3f9fdb/attachment-0001.html>


More information about the rspec-users mailing list