2008/2/22 Irvan <[EMAIL PROTECTED]>:

>
> ----------------------------------------------------------------
> def create
>    begin
>      @item = Item.new(params[:item])
>      if @item.save
>        flash[:notice] = 'Item was successfully created.'
>        redirect_to :action => 'list'
>      else
>        render :action => 'new'
>      end
>    rescue *# disini harus exception apa?*
>      flash['notice']="Tdk bs di save"
>      *# saya ingin mendapatkan SQLSTATE error disini*
>      redirect_to :action => "new"
>    end
>  end
>

begini maksudnya ? => rescue ActiveRecord::RecordInvalid

tapi methodnya diganti jadi @item.save! (akan otomatis raise error), kalo
.save tidak (return boolean) (nebak2 aja)

  begin
     @item = Item.new(params[:item])
     @item.save!
     flash[:notice] = 'Item was successfully created.'
     redirect_to :action => 'list'
  rescue ActiveRecord::RecordInvalid
     flash[:notice] = 'Failed to save'
     render :action => 'new'
  end



----------------------------------------------------------------
>
> nah..gitu..
> mohon bantuannya....trima kasihhhh
>
> --
> Regards,
>
> Irvan Setiyanto
>


-- 
irfani

YM : irfani_s
http://irfani.web.id


[Non-text portions of this message have been removed]

Kirim email ke