RoR newbie needs help with instance variables and view

The problem here is that you're loading the categories in the 'new' action but your form error page is shown in the 'create' action - notice that your 'create' has no reference to @category in it. Now, you are calling 'render :action => 'new'' which will cause the create template to be rendered, but it will not load the categories.

You have a couple of options - you could put another '@categories =..' statement in the 'create' action, but that would mean duplicating code. The best options are to either use a before_filter (see http:// api.rubyonrails.org/classes/ActionController/Filters/ ClassMethods.html), or you can compress your create/new actions into one:

def new    @categories = Category.find(:all, :order => "description asc")    if request.post?      @product = Product.new(params[:product])      if @product.save        flash[:notice] = 'Product was successfully created.'        redirect_to :action => 'timeframe'     end    else      @product = Product.new   end end

You can then just put 'new' as your form action.

Hope that helps,

Steve