ruby on rails - Form object pattern with validation using read_attribute -



ruby on rails - Form object pattern with validation using read_attribute -

i using form object pattern https://robots.thoughtbot.com/activemodel-form-objects deal validations in house model.

i have validation needs utilize read_attribute, because want check length of field not longer 20 db encoding.

so, if validation in house model, this:

if read_attribute(name).length > 20 # add together error end

however since in houseform class context. can't that.

what right approach in case?

ruby-on-rails validation

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -