I have a variable @products = Product.all defined inside new method in a controller. It contains values from a db table to be shown in a select box on form.
When the create method raise validation errors I am calling render :action => 'new'.
All the other variables seem to come back fine, but @products comes back as nil
What am I missing here.
render :action => newis askingActionViewto render the view for thenewaction — it does not run thenewaction in the current controller, as you may expect.From http://guides.rubyonrails.org/layouts_and_rendering.html#using-render: