def new
    @student = Student.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @student }
    end
  end

  def create
    @student = Student.new(params[:student])

    respond_to do |format|
      if @student.save
        format.html { redirect_to(@student, :notice => 'Student was
successfully created.') }
        format.xml  { render :xml => @student, :status => :created,
:location => @student }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @student.errors, :status =>
:unprocessable_entity }
      end
    end
  end

___________________________________________________________________________________


2011/5/15 Luis Lavena <[email protected]>

> Perdón por el top posting. Si pudieras compartir el código del controller
> podríamos ayudarte mejor, por que en create es donde podría estar el
> problema.
>
> Sent from mobile.
> On May 15, 2011 11:24 AM, "Paolo Loran" <[email protected]> wrote:
> > Buenas a todos, les molesto esta vez porque tengo un problema con las
> > validaciones.
> > Por ejemplo tengo un Estudiante al cual valido la presencia del dni, como
> > asi tambien que sea unico.
> > luego al agrego un nuevo estudiante y a proposito genero el error de
> campos
> > vacios para que me muestre la notificacion, pero esta no se informa
> > y me lleva a index, aclaro que tampoco guarda al nuevo estudiante en la
> BD.
> >
> > que podra ser??
> >
> > abrazo, poli
>
> _______________________________________________
> Ruby mailing list
> [email protected]
> http://lista.rubyargentina.com.ar/listinfo.cgi/ruby-rubyargentina.com.ar
>
>
_______________________________________________
Ruby mailing list
[email protected]
http://lista.rubyargentina.com.ar/listinfo.cgi/ruby-rubyargentina.com.ar

Responder a