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

Using Android Volley to post an array to PHP -

python - How to add an model instance to a django queryset? -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -