html - .collect method get an error undefined method `collect' for nil:NilClass -
I am trying to list a drop down list, but give it to me when I try
Regarding 'Gathering' method for regulator: Null Class
Controller:
DRF Existing @ course = course. All-end DP duplicate course = course.fund_b_id (permitd_up [: ID ]) New_course = course.dup if new_course.save redirect_to: action = & gt; 'Show' and Redirect-to: Back End End View:
& lt; H3 & gt; Choose a course & lt; / H3 & gt; & Lt;% = form_for: course, url: {: action = & gt; "Duplicate", Method: "Post"}. f |% & gt; & Lt;% = f.select: id, @ course. Collect {| c | | [Seed, CNN]}%> & Lt; Br> & Lt; Br> & lt;% = f.submit% & gt; & Lt;% end% & gt;
You will receive the following error
undefined blue Method to 'Collect': NilClass at
Only when @ course example variable was not set in the action that provided this particular view. I think the @ course variable has been set in the existing method. If you are using existing as an action that presents this view then your view name should be existing.html. ARB . Or if you are rendering with a different action, in that case, you should set the @ course value in either that special action, either by directing the value within the direct action or by there Should be set by calling the current method.
Comments
Post a Comment