[Rails] Re: validating input values(integer)

2012-05-04 Thread Soichi Ishida
> validates :price, :numericality => { :only_integer => true } > > (note the plural 'validates' rather than 'validate' - they do two quite > different things!) > I must be blind! It should have been validates :price, :presence => true, ... and plural, yes, it reminds me Rails like plural noun

[Rails] Re: validating input values(integer)

2012-05-04 Thread Matt Jones
On Friday, 4 May 2012 03:16:32 UTC-4, Ruby-Forum.com User wrote: > > Rails 3.1.3 > > I have a table 'Contribution' having a column, 'price' which must be > integers. > > validate :price => true, :numericality => { :only_intger => true } > > I'm not sure what effect this syntax will actually

Re: [Rails] Re: validating input values(integer)

2012-05-04 Thread Michael Pavling
On 4 May 2012 09:41, Soichi Ishida wrote: > 1.9.3-p0 :008 > 'this'.to_i >  => 0 > 1.9.3-p0 :009 > > > It's zero...it does not seem good at all ;) That's a different thread entirely ;-) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To

[Rails] Re: validating input values(integer)

2012-05-04 Thread Soichi Ishida
Thanks for your reply. > If you pop open a Rails console and type: > > 'this'.to_i > > What result do you get? 1.9.3-p0 :008 > 'this'.to_i => 0 1.9.3-p0 :009 > It's zero...it does not seem good at all ;) soichi -- Posted via http://www.ruby-forum.com/. -- You received this message beca