KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to redirect to the a models index view after saving my model. def create @test = Test.new(params[:test]) respond_to do |format| if @test.save format.html { redirect_to @test, notice: 'test was successfully created.' } else format.html { render action: "new" } end end end I've tried format.html { render action: "index", notice: 'Test was successfully created.' } but I get the following error in /app/views/tests/index.html.erb - undefined method `each' for nil:NilClass Any idea what's going wrong?
Tags (comma-separated)
Save Edits
Cancel