hi guys
Thanks for the support you give
I have some four fields which is not mandatory, but when that field is
entered need to be validated before saved
else
it can take null value
can you please guide me
–
Karthik.k
Mobile - +91-9894991640
hi guys
Thanks for the support you give
I have some four fields which is not mandatory, but when that field is
entered need to be validated before saved
else
it can take null value
can you please guide me
–
Karthik.k
Mobile - +91-9894991640
2009/8/20 karthik k [email protected]:
can you please guide me
Have a look at the rails guide on validations,
http://guides.rubyonrails.org/activerecord_validations_callbacks.html
Colin
On Thu, Aug 20, 2009 at 4:34 PM, Rails L. <
[email protected]> wrote:
can you please guide me
validates_numericality_of :age, :allow_blank=>true
endThis will let blank but when something is there it will be validated for
numbers.http://www.classifiedscript.in
Craigslist Clone
Hi
Thank you
–
Karthik.k
Mobile - +91-9894991640
Karthik Kantharaj wrote:
hi guys
Thanks for the support you give
I have some four fields which is not mandatory, but when that field is
entered need to be validated before saved
else
it can take null value
can you please guide meKarthik.k
Mobile - +91-9894991640
Assume that you have an age field that should not be validated if it is
blank. But should be validated when something is entered
#your Model
class Employee < ActiveRecord::Base
validates_numericality_of :age, :allow_blank=>true
end
This will let blank but when something is there it will be validated for
numbers.
http://www.classifiedscript.in
Craigslist Clone
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs