Re: [Rails] Re: Field validation

2010-06-17 Thread lucas franceschi
try looking Here . Sempre Alerta Para Servir, Lucas Franceschi Equipe de Programação (Automação) SGI Sistemas (049) 9922-3360 On Thu, Jun 17, 2010 at 12:14 PM, lucas franceschi wrote: > well... in fact... yo

Re: [Rails] Re: Field validation

2010-06-17 Thread lucas franceschi
well... in fact... you did defined it as an "integer" so, dont expect to get any other class thats not Fixnum or Bignum... but, you can also use some model validations to be sure that the user entered an integer... try validates_numericality_of :cost it will stop your user from entering strings..

[Rails] Re: Field validation

2010-06-17 Thread Stanislav Orlenko
Colin Law wrote: > On 16 June 2010 11:34, Stanislav Orlenko wrote: >> � � �errors.add_to_base("Error message") unless cost.is_a?(Fixnum) >> >> when I enter 'asdf': >> >> ### 0: Fixnum >> >> I completely can't understand what happen. In migration: >> >> t.integer :cost >> >> I think ActiveRectord c

[Rails] Re: Field validation

2010-06-16 Thread Stanislav Orlenko
Pale Horse wrote: > Stanislav Orlenko wrote: >> >> Can I in some way check cost value in model (value should be numeral and >> integer)? >> >> Thanks in advance! > > validates_numericality_of? I use errors.add_to_base because I don't want to show field's name in the error message(i. e. Cost bla

[Rails] Re: Field validation

2010-06-16 Thread Pale Horse
Stanislav Orlenko wrote: > > Can I in some way check cost value in model (value should be numeral and > integer)? > > Thanks in advance! validates_numericality_of? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on R