RE: Doubts on validation

Hi adam,
Thanks for responding to my question. I did not write the controller
properly. My bad. I did not have the else part.
Part of the learning process!!

def create
begin
@student = Student.new(@params[:student])
if @student.save
flash[:notice] = ‘Student was successfully created.’
redirect_to :action => ‘list’
else
@offices = Office.find_all
@programs = Program.find_all
@courses = Course.find_all
render :action => ‘new’
end
rescue
flash[‘notice’] = ‘Item could not be saved.’
redirect_to :action => ‘new’
end
end

Thanks
Silvy

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs