--- In [email protected], dhendy ferdian <[EMAIL PROTECTED]> wrote:
>
> Klo aku biasa pake "error_message_on" dit
>
> implementasi sederhananya kaya gini
> "mau kasih validasi not null di field description"
>
> di Modelnya
> ==========
>
> validates_presence_of :description, :message => "tidak boleh kosong"
>
> di viewnya
> ========
> <%= flash[:notice] %>
>
> ....
> <label>
> <em>Description</em><%= text_field 'object','description' %>
> <%= error_message_on 'onject', 'description' %>
> </label>
> .....
>
> di controllernya
> ===========
> bikin konstanta
> SUCCESS = "Your changes have been saved.".freeze
> ERROR = "Please check below for any highlighted mistakes...".freeze
>
> def create
> .....
> if @threshold.save
> flash[:notice] = SUCCESS
> redirect_to :action => 'list'
> else
> flash[:notice] = ERROR
> render :action => 'new'
> end
> ......
> end
>
>
> kurang lebih nya gitu .... :)
>
> thanks,
> Dhendy Ferdian
>
> Aditya Agustyana <[EMAIL PROTECTED]> wrote:
secara situs ini down
> http://wiki.rubyonrails.org/rails/pages/Custom+Error+Message, daku
> cukup kesulitan gmn caranya bikin custome error messages buat active
> -record (misale translate pesan itu ke bhs indonesia)
>
> terutama yang kata2 ini 1 errors prohibited this user from being saved
>
> bisa aja sih method <%= error_messages_for %> di gsub, tapi aku
> ngerasa itu cara "kotor", lagian kan error yg muncul bisa lebih
dari satu
>
> sohibs, ada yg tau gmn ngakali hal ini ?
>
> makasih sebelumnya
>
>
>
>
>
>
> ---------------------------------
> Take the Internet to Go: Yahoo!Go puts the Internet in your pocket:
mail, news, photos & more.
>
> [Non-text portions of this message have been removed]
>
oalah kata2 "being saved-nya" diakali pake flash yak (xixixi kagak
kepikiran) ..., hmm ide bagus nih... tak coba ah