Reputation: 1113
After creating a new object I want to take the user straight to the edit page for that object.
If I do that with
if @object.save
flash[:success] = "Object added!"
render 'edit
I get an "undefined method `empty?' for nil:NilClass" error.
If I go to the index view and click through to the edit view for that object I can edit it just fine.
Do I need to use redirect_to rather than render? and if so what is the correct way to phrase it?
Upvotes: 0
Views: 845
Reputation: 4633
Try:
redirect_to edit_"whatever"_path(@object)
It should work.
As you are actually rendering the template, but not the action.
Upvotes: 1