http://www.gotapi.com/rubyrails

such nach der methode
dann findest du das hier:

class Person < ActiveRecord::Base
    validates_length_of :first_name, :maximum=>30
    validates_length_of :last_name, :maximum=>30, :message=>"less than %d
if you don't mind"
    validates_length_of :fax, :in => 7..32, :allow_nil => true
    validates_length_of :phone, :in => 7..32, :allow_blank => true
    validates_length_of :user_name, :within => 6..20, :too_long => "pick a
shorter name", :too_short => "pick a longer name"
    validates_length_of :fav_bra_size, :minimum=>1, :too_short=>"please
enter at least %d character"
    validates_length_of :smurf_leader, :is=>4, :message=>"papa is spelled
with %d characters... don't play me."
end


validates_length_of :user_name, :within => 6..20, :too_long => "pick a
shorter name", :too_short => "pick a longer name"

macht ja auch nur sinn, dass man ne message für zu lang und zu kurz
angibt...

die docu sollte solche fragen ohne weiteres erklären...

gruß
manuel

Am 28.05.2008 um 11:53 schrieb Rene P.:

validates_length_of


On Wed, 28 May 2008 11:53:30 +0200, "Rene P." <[EMAIL PROTECTED]> wrote:
> Hi Werner,
>
> genau das habe ich auch schon gefunden nur an was ich gerade zu beissen
> habe ist warum ich so wie bei deinem Beispiel auch
>    validates_length_of :name, :within => 6..100
> ich danach kein Message=>"Zeichen müssen zwischen ..."
> also wenn ich das mache -->
>    validates_length_of :name, :within => 6..100, :message=>"TEXT"
> kommt der englische standardtext.
>
>
>
> Werner Laude wrote:
>> Am 28.05.2008 um 10:47 schrieb Werner Laude:
>>
>>>
>>> stichwort: rails validation  =>in google
>>>
>>> Denke du solltest dir wirklich ein Buch besorgen..Amazon gebraucht
>>> ca. 20 Euro
>>> Ich mache mich ja schon unbeliebt hier mit meinen Fragen...
>>> aber das ist wirklich Basisstoff, den solltest du dir per Buch/ per
>>> google erarbeiten.
>>>
>>
>>
>> anbei f�r dein Model
>>
>>
>>   validates_length_of :name, :within => 6..100
>>    validates_uniqueness_of :name
>>    validates_format_of :name, :with => /^\w+$/, :message => "cannot
>> contain whitespace"
>>    validates_length_of :content, :minimum => 10
>>
>> Denke mal selbsterkl�rend...
>>
>>>
>>
>> Werner Laude
>> Lindenburger Allee 22  -  50931
>> K�ln
> 0221.8805 635
>>
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> http://www.webagentur-laude.de
>>
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> --
> Posted via http://www.ruby-forum.com/.

_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug

Antwort per Email an