Validates_presence_of

Hi, having a few problems working out whats kicking off,

im using validates_presence_of :title in a models class

this seemed to work fine untill I used a custom new.rhtml

error message I am gaining is

NoMethodError in Recipe#create

Showing app/views/recipe/new.rhtml where line #15 raised:

You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.each

12:


13: Category:

14:
15: <% @categories.each do |category| %>
16:
17: <%= category.name %>
18:

the def create controller looks somthing like this

    def create
	@recipe = Recipe.new(@params['recipe'])
	@recipe.date = Date.today
	if @recipe.save
		redirect_to :action => 'list'
		else
		render_action 'new'
	end
end

any suggestions to where im going wrong?

It looks like you need to get @categories in your create method so that
it will be available in your template.