I have the following scaffold generated code which does not run. It does not
even hit the breakpoint.
def create
breakpoint()
@student = Student.new(params[:student])
if @student.save
flash[:notice] = ''Student was successfully created.''
redirect_to :action => ''list''
else
render :action => ''new''
end
end
I decided to run functional test on the controller. Here is the result:
1) Failure:
test_create(StudentControllerTest)
[test/functional/student_controller_test.rb:55]:
Expected response to be a <:redirect>, but was <200>
Also from another action I get the following error:
2) Failure:
test_edit(StudentControllerTest)
[test/functional/student_controller_test.rb:68]:
<false> is not true.
I don''t undertand why this code fails and what the failure means.
Can someone also please explain when to use redirect_to vs. render? Thanks
for your help.
-bakki kudva
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060106/d6910d51/attachment.html