Render - Missing Template

Sorry if you have had this problem many times before. I just can’t
seem to find the problem.

I have a budget controller with a create action like this:

def create

# do some things

if budget.save
  redirect_to(period_budgets_path(period))
else
  @budget = budget
  @expense = budget.expense
  @period = budget.period
  render :action => "new"
end

end

When I try to save an invalid budget, I get a missing template error.
Sorry, I don’t have the exact message with me now but it basically
says ‘missing template new.erb’.

I do have a new.html.erb so I am not sure what is going wrong.

If I use
render :template => “budgets/new.html.erb”

That kind of works, but I get a strange URL of:
http://localhost:3000/periods/1/budgets.%23budget:0xb719b18c

Why is render :action => “new” not working in my case?

Again, I am sorry if this group has been inundated with similar
questions, I am just completely stuck!

Thank you!

On Mar 1, 10:13 am, Daryn [email protected] wrote:

render :template => “budgets/new.html.erb”

That kind of works, but I get a strange URL of:http://localhost:3000/periods/1/budgets.%23budget:0xb719b18c

I think this is actually the route of the problem - the post is going
to this url, which rails is interpreting as someone requesting a
document with a non html format.

What does your form look like ?

Fred