Reputation: 113
I have 2 controllers: Projects
and Users
. Both models have no relation at all.
When I create a new Project
I want to redirect to the new User path
after saving the new project
, but all my tries give erros like missing template or stuff like that.
How can I get this working?
EDITED
My create method in Projects
controller:
def create
@project = Project.new(params[:project])
respond_to do |format|
if @project.save
format.html { render (new_user_registration_path) }
else
format.html { render :action => "new" }
format.xml { render :xml => @project.errors, :status => :unprocessable_entity }
end
end
end
Upvotes: 1
Views: 2691
Reputation: 7023
You don't want to render new_user_registration_path, you want to redirect_to new_user_registration_path
Upvotes: 3
Reputation: 542
you must use redirect_to instead render:
redirect_to new_user_registration_path
respond_to do |format|
if @project.save
format.html { redirect_to new_user_registration_path }
else
format.html { render :action => "new" }
format.xml { render :xml => @project.errors, :status => :unprocessable_entity }
end
end
Upvotes: 0